Skip to content

Tapping TextFormField throws _CastError was thrown during method call TextInputClient.performPrivateCommand type 'Null' is not a subtype of type 'Map<String, dynamic>' #113973

@absar

Description

@absar

Steps to Reproduce

  1. Use an Android 5 device e.g. HTC One M1
  2. Execute flutter run on the code sample
  3. Just Tap inside the form field. It will throw

The issue only occurs on Flutter 3.3, it works fine on 3.0...

Expected results:
No error should occur

Actual results:
_CastError was thrown during method call TextInputClient.performPrivateCommand: type 'Null' is not a subtype of type 'Map<String, dynamic>' in type cast

Code sample
void main() => runApp(const TextInputErrorHome());

class TextInputErrorHome extends StatelessWidget {
  const TextInputErrorHome({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(primarySwatch: Colors.blue),
      home: const TextInputErrorApp(),
    );
  }
}

class TextInputErrorApp extends StatefulWidget {
  const TextInputErrorApp({super.key});

  @override
  State<TextInputErrorApp> createState() => _TextInputErrorAppState();
}

class _TextInputErrorAppState extends State<TextInputErrorApp> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(),
      body: Center(
        child: Padding(
          padding: const EdgeInsets.all(20.0),
          child: Column(
            children: [
              TextFormField(
                decoration: const InputDecoration(
                    hintText: 'Tap here it will throw',
                    label: Text('Numeric keyboard')),
                keyboardType:
                    const TextInputType.numberWithOptions(decimal: true),
              ),
              const SizedBox(height: 30),
              TextFormField(
                decoration: const InputDecoration(
                    hintText: 'Tap here it will throw',
                    label: Text('Normal keyboard')),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
Logs
======== Exception caught by services library ======================================================
The following _CastError was thrown during method call TextInputClient.performPrivateCommand: type 'Null' is not a subtype of type 'Map<String, dynamic>' in type cast

When the exception was thrown, this was the stack: 
#0      TextInput._handleTextInputInvocation (package:flutter/src/services/text_input.dart:1823:28)
#1      TextInput._loudlyHandleTextInputInvocation (package:flutter/src/services/text_input.dart:1701:20)
#2      MethodChannel._handleAsMethodCall (package:flutter/src/services/platform_channel.dart:536:55)
#3      MethodChannel.setMethodCallHandler.<anonymous closure> (package:flutter/src/services/platform_channel.dart:529:34)
#4      _DefaultBinaryMessenger.setMessageHandler.<anonymous closure> (package:flutter/src/services/binding.dart:387:35)
#5      _invoke2 (dart:ui/hooks.dart:186:13)
#6      _ChannelCallbackRecord.invoke (dart:ui/channel_buffers.dart:42:5)
#7      _Channel.push (dart:ui/channel_buffers.dart:132:31)
#8      ChannelBuffers.push (dart:ui/channel_buffers.dart:329:17)
#9      PlatformDispatcher._dispatchPlatformMessage (dart:ui/platform_dispatcher.dart:599:22)
#10     _dispatchPlatformMessage (dart:ui/hooks.dart:89:31)
call: MethodCall(TextInputClient.performPrivateCommand, [2, {action: com.htc.sense.ime.getInputExtras}])
flutter analyze
Analyzing issue_reproducibles...                                        
No issues found! (ran in 3.6s)
flutter doctor -v
[√] Flutter (Channel stable, 3.3.5, on Microsoft Windows [Version 10.0.19044.2130], locale en-US)
[√] Flutter (Channel stable, 3.3.5, on Microsoft Windows [Version 10.0.19044.2130], locale en-US)
    • Flutter version 3.3.5 on channel stable at c:\Apps\flutter                                 
    • Upstream repository https://github.com/flutter/flutter.git                                 
    • Framework revision d9111f6402 (5 days ago), 2022-10-19 12:27:13 -0700                      
    • Engine revision 3ad69d7be3                                                                 
    • Dart version 2.18.2                                                                        
    • DevTools version 2.15.0                                                                    
                                                                                                 
[√] Android toolchain - develop for Android devices (Android SDK version 32.0.0-rc1)             
    • Android SDK at c:\Apps\Android\Sdk                                            
    • Platform android-33, build-tools 32.0.0-rc1                                   
    • ANDROID_HOME = c:\Apps\Android\Sdk                                            
    • Java binary at: c:\Apps\Android Studio\jre\bin\java                           
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)   
    • All Android licenses accepted.                                                

[√] Chrome - develop for the web
    • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[X] Visual Studio - develop for Windows
    X Visual Studio not installed; this is necessary for Windows development.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components

[√] Android Studio (version 2021.3)
    • Android Studio at c:\Apps\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)

[√] IntelliJ IDEA Ultimate Edition (version 2021.1)
    • IntelliJ at c:\Apps\JetBrains\IntelliJ IDEA 2021.1
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart

[√] Connected device (3 available)
    • Windows (desktop) • windows      • windows-x64    • Microsoft Windows [Version 10.0.19044.2130]
    • Chrome (web)      • chrome       • web-javascript • Google Chrome 106.0.5249.119
    • Edge (web)        • edge         • web-javascript • Microsoft Edge 104.0.1293.47

[√] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.

Metadata

Metadata

Assignees

No one assigned

    Labels

    r: fixedIssue is closed as already fixed in a newer version

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions