Skip to content

Crashes on Flutter 3.47.0 #237

Closed

Description

@jonmountjoy

Pinput doesn't work on Flutter 3.47.0, if you use the new material_ui/cupertino_ui packages.

In particular, it crashes with a "No Material widget found":

#0      debugCheckHasMaterial.<anonymous closure> (package:flutter/src/material/debug.dart:40:7)
#1      debugCheckHasMaterial (package:flutter/src/material/debug.dart:67:4)
#2      _PinputState.build (package:pinput/src/pinput_state.dart:289:12)

The problem is this line in pinput_state.dart

assert(debugCheckHasMaterial(context));

I believe that the problem is that debugCheckHasMaterial looks for a Material class in the ancestors, but the Material class in material_ui is a different class.

To Reproduce

  1. Install Flutter 3.47.0
  2. Go the example folder of pinput
  3. Modify the pubspec.yaml to force the latest version of flutter:
  sdk: ^3.13.0
  flutter: '>=3.46.0'
  1. Run the upgrader dart fix --apply --code=migrate_design_widgets
  2. Run the example app - it will work.
  3. Modify the example app, and replace import 'package:flutter/material.dart'; with import 'package:material_ui/material_ui.dart';
  4. The app will no longer work.

To avoid

I can do something nasty to avoid the problem - which is to wrap the Pinput in the "old" Material class:

import 'package:material_ui/material_ui.dart';
import 'package:flutter/material.dart' as hack;

Widget myPut() {
  return hack.Material(child: Pinput(....));
}

Activity

  1. lukas-pierce commented on Aug 17, 2026

    @lukas-pierce

    Temp wrapper:

    import 'package:flutter/material.dart' as old;
    
    // temp wrapper
    // TODO https://github.com/Tkko/Flutter_Pinput/issues/237
    class _PinputTempWrapper extends StatelessWidget {
      const _PinputTempWrapper({required this.child});
    
      final Pinput child;
    
      @override
      Widget build(BuildContext context) {
        return MaterialUiCompatibilityBridge(
          child: old.Material(
            type: old.MaterialType.transparency,
            child: child,
          ),
        );
      }
    }

    Usage:

    _PinputTempWrapper(
      child: Pinput(...)
    )
  2. added a commit that references this issue on Oct 8, 2026
    a98e218
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions