Skip to content

Null check operator used on a null value occurs in EditableTextState when entering text on Galaxy keyboard #112046

Closed as not planned

Description

@hidekitux

Steps to Reproduce

This error only occurs on Galaxy as far as I can confirm.
I couldn't check it on my Xiaomi Pad 5.

  1. Execute flutter run on the code sample with Galaxy device
  2. Enter some text in the TextField
  3. An error occurs when I press the decision button of IME

Expected results:
The following _CastError was thrown during method call TextInputClient.performPrivateCommand: Null check operator used on a null value

Actual results:

======== Exception caught by services library ======================================================
The following _CastError was thrown during method call TextInputClient.performPrivateCommand:
Null check operator used on a null value

When the exception was thrown, this was the stack: 
#0      EditableTextState.performPrivateCommand (package:flutter/src/widgets/editable_text.dart:2155:31)
#1      TextInput._handleTextInputInvocation (package:flutter/src/services/text_input.dart:1821:37)
#2      TextInput._loudlyHandleTextInputInvocation (package:flutter/src/services/text_input.dart:1701:20)
#3      MethodChannel._handleAsMethodCall (package:flutter/src/services/platform_channel.dart:536:55)
#4      MethodChannel.setMethodCallHandler.<anonymous closure> (package:flutter/src/services/platform_channel.dart:529:34)
#5      _DefaultBinaryMessenger.setMessageHandler.<anonymous closure> (package:flutter/src/services/binding.dart:387:35)
#6      _invoke2 (dart:ui/hooks.dart:186:13)
#7      _ChannelCallbackRecord.invoke (dart:ui/channel_buffers.dart:42:5)
#8      _Channel.push (dart:ui/channel_buffers.dart:132:31)
#9      ChannelBuffers.push (dart:ui/channel_buffers.dart:329:17)
#10     PlatformDispatcher._dispatchPlatformMessage (dart:ui/platform_dispatcher.dart:599:22)
#11     _dispatchPlatformMessage (dart:ui/hooks.dart:89:31)
call: MethodCall(TextInputClient.performPrivateCommand, [1, {data: {yomi: あ}, action: com.sec.android.inputmethod.iwnnime.japan}])
====================================================================================================
I/ViewRootImpl@ec33a10[MainActivity](27215): ViewPostIme pointer 0
I/ViewRootImpl@ec33a10[MainActivity](27215): ViewPostIme pointer 1
I/ViewRootImpl@ec33a10[MainActivity](27215): ViewPostIme pointer 0
I/ViewRootImpl@ec33a10[MainActivity](27215): ViewPostIme pointer 1
Code sample
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(),
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Flutter Demo Home Page'),
      ),
      body: const Center(child: TextField()),
    );
  }
}
Logs
[+5490 ms] I/InputMethodManager(29583): showSoftInput(View,I)
[   +1 ms] D/InputMethodManager(29583): SSI - flag : 0 Pid : 29583 view : com.example.flutter_bug_sample
[   +1 ms] W/InputMethodManager(29583): showSoftInput(V,I,ResultReceiver)
[        ] D/InputMethodManager(29583): prepareNavigationBarInfo() DecorView@6852e6a[MainActivity]
[        ] D/InputMethodManager(29583): getNavigationBarColor() -855310
[        ] D/InputConnectionAdaptor(29583): The input method toggled text monitoring on
[+1167 ms] D/InputConnectionAdaptor(29583): The input method toggled text monitoring off
[  +81 ms] 
           ══╡ EXCEPTION CAUGHT BY SERVICES LIBRARY ╞══════════════════════════════════════════════════════════ 
           The following _CastError was thrown during method call TextInputClient.performPrivateCommand:        
           Null check operator used on a null value

           When the exception was thrown, this was the stack:
           #0      EditableTextState.performPrivateCommand
(package:flutter/src/widgets/editable_text.dart:2155:31)
           #1      TextInput._handleTextInputInvocation (package:flutter/src/services/text_input.dart:1821:37)  
           #2      TextInput._loudlyHandleTextInputInvocation
(package:flutter/src/services/text_input.dart:1701:20)
           #3      MethodChannel._handleAsMethodCall (package:flutter/src/services/platform_channel.dart:536:55)
           #4      MethodChannel.setMethodCallHandler.<anonymous closure>
           (package:flutter/src/services/platform_channel.dart:529:34)
           #5      _DefaultBinaryMessenger.setMessageHandler.<anonymous closure>
           (package:flutter/src/services/binding.dart:387:35)
           #6      _invoke2 (dart:ui/hooks.dart:186:13)
           #7      _ChannelCallbackRecord.invoke (dart:ui/channel_buffers.dart:42:5)
           #8      _Channel.push (dart:ui/channel_buffers.dart:132:31)
           #9      ChannelBuffers.push (dart:ui/channel_buffers.dart:329:17)
           #10     PlatformDispatcher._dispatchPlatformMessage (dart:ui/platform_dispatcher.dart:599:22)        
           #11     _dispatchPlatformMessage (dart:ui/hooks.dart:89:31)

           call:
             MethodCall(TextInputClient.performPrivateCommand, [1, {data: {yomi: あ}, action:
             com.sec.android.inputmethod.iwnnime.japan}])
           ════════════════════════════════════════════════════════════════════════════════════════════════════
flutter analyze
Analyzing flutter_bug_sample...                                         
No issues found! (ran in 2.6s)
PS C:\Users\tuxsnct\Projects\flutter_bug_sample> flutter doctor -v
[√] Flutter (Channel stable, 3.3.2, on Microsoft Windows [Version 10.0.22000.978], locale ja-JP)
    • Flutter version 3.3.2 on channel stable at C:\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision e3c29ec00c (7 days ago), 2022-09-14 08:46:55 -0500
    • Engine revision a4ff2c53d8
    • Dart version 2.18.1
    • DevTools version 2.15.0

[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at C:\Users\tuxsnct\AppData\Local\Android\sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
    • All Android licenses accepted.

[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:\Program Files\Android\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)

[√] VS Code (version 1.70.0)
    • VS Code at C:\Users\tuxsnct\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.46.0

[√] Connected device (2 available)
    • SCG09 (mobile)    • R3CR10MJBMP • android-arm64 • Android 11 (API 30)
    • Windows (desktop) • windows     • windows-x64   • Microsoft Windows [Version 10.0.22000.978]

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

! Doctor found issues in 1 category.

Activity

  1. hidekitux commented on Sep 21, 2022

    @hidekitux
    Author

    In flutter\lib\src\widgets\editable_text.dart, if I change EditableTextState.performPrivateCommand to:

      @override
      void performPrivateCommand(String action, Map<String, dynamic> data) {
        if (widget.onAppPrivateCommand != null) widget.onAppPrivateCommand!(action, data);
      }
  2. ksokolovskyi commented on Sep 21, 2022

    @ksokolovskyi
    Contributor

    We spot the same error on the users' Samsung devices (samsung SM-T580, samsung SM-S908B, samsung SM-A326B)
    Flutter version 3.3.2

  3. added
    in triagePresently being triaged by the triage team
    on Sep 21, 2022
  4. itismrx commented on Sep 21, 2022

    @itismrx

    I am facing the same error on Samsung Galaxy J6 (SM J600G). Flutter version 3.3.0.

    `
    When the exception was thrown, this was the stack:
    #0 EditableTextState.performPrivateCommand (package:flutter/src/widgets/editable_text.dart:2155:31)
    #1 TextInput._handleTextInputInvocation (package:flutter/src/services/text_input.dart:1821:37)
    #2 TextInput._loudlyHandleTextInputInvocation (package:flutter/src/services/text_input.dart:1701:20)
    #3 MethodChannel._handleAsMethodCall (package:flutter/src/services/platform_channel.dart:536:55)
    #4 MethodChannel.setMethodCallHandler. (package:flutter/src/services/platform_channel.dart:529:34)
    #5 _DefaultBinaryMessenger.setMessageHandler. (package:flutter/src/services/binding.dart:387:35)
    #6 _invoke2 (dart:ui/hooks.dart:186:13)
    #7 _ChannelCallbackRecord.invoke (dart:ui/channel_buffers.dart:42:5)
    #8 _Channel.push (dart:ui/channel_buffers.dart:132:31)
    #9 ChannelBuffers.push (dart:ui/channel_buffers.dart:329:17)
    #10 PlatformDispatcher._dispatchPlatformMessage (dart:ui/platform_dispatcher.dart:599:22)
    #11 _dispatchPlatformMessage (dart:ui/hooks.dart:89:31)

    call:
    MethodCall(TextInputClient.performPrivateCommand, [1, {data: {}, action: Normal_Mode}])
    ════════════════════════════════════════════════════════════════════════════════════════════════════
    `

  5. huycozy commented on Sep 21, 2022

    @huycozy
    Member

    Hi @tuxsnct, @ksokolovskyi, @itismrx
    I can not reproduce the issue on the latest stable and master channels.
    My device: Samsung Galaxy Tab A7 Lite, Android 12 OneUI 4.1, SM-T225

    However, I see there's an open issue addressing the case you described #97634
    Closing this issue as a duplicate, so please follow up on it for further updates. You can leave there your comment and react an upvote to the original comment will help to raise the issue. Thank you!

  6. added
    r: duplicateIssue is closed as a duplicate of an existing issue
    and removed
    in triagePresently being triaged by the triage team
    on Sep 21, 2022
  7. damian4891 commented on Oct 3, 2022

    @damian4891

    Our app has 500,000 users, and we received 690 crash reports last night. Also using flutter 3.3.3. Same error on EVERY single crash report, and every device was Samsung:

    #0 EditableTextState.performPrivateCommand (package:flutter/src/widgets/editable_text.dart:2155)
    #1 TextInput._handleTextInputInvocation (package:flutter/src/services/text_input.dart:1821)
    #2 TextInput._loudlyHandleTextInputInvocation (package:flutter/src/services/text_input.dart:1701)
    #3 MethodChannel._handleAsMethodCall (package:flutter/src/services/platform_channel.dart:536)
    #4 MethodChannel.setMethodCallHandler.<anonymous closure> (package:flutter/src/services/platform_channel.dart:529)
    #5 _DefaultBinaryMessenger.setMessageHandler.<anonymous closure> (package:flutter/src/services/binding.dart:387)
    #6 _invoke2 (dart:ui/hooks.dart:186)
    #7 _ChannelCallbackRecord.invoke (dart:ui/channel_buffers.dart:42)
    #8 _Channel.push (dart:ui/channel_buffers.dart:132)
    #9 ChannelBuffers.push (dart:ui/channel_buffers.dart:329)
    #10 PlatformDispatcher._dispatchPlatformMessage (dart:ui/platform_dispatcher.dart:599)
    #11 _dispatchPlatformMessage (dart:ui/hooks.dart:89)
    

    This issue needs to please be URGENTLY FIXED. The exact lines of code causing the crash are clearly shown in the error log, surely it isn't that hard to fix? We cannot afford to have hundreds of crashes every day due to flutter bugs.

  8. aprzedecki commented on Oct 6, 2022

    @aprzedecki

    The same for my app Flutter 3.3.2.

    Fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: Null check operator used on a null value. Error thrown Instance of 'ErrorDescription'.
           at EditableTextState.performPrivateCommand(editable_text.dart:2155)
           at TextInput._handleTextInputInvocation(text_input.dart:1821)
           at TextInput._loudlyHandleTextInputInvocation(text_input.dart:1701)
           at MethodChannel._handleAsMethodCall(platform_channel.dart:536)
           at MethodChannel.setMethodCallHandler.<fn>(platform_channel.dart:529)
           at _DefaultBinaryMessenger.setMessageHandler.<fn>(binding.dart:387)
    
  9. GrrMoura commented on Oct 7, 2022

    @GrrMoura

    hey guys, any idea how to fix it ?

  10. Simon-PumpAndUp commented on Oct 12, 2022

    @Simon-PumpAndUp

    Same as OP. flutter run -> text input and get the following:

    `══╡ EXCEPTION CAUGHT BY SERVICES LIBRARY ╞══════════════════════════════════════════════════════════
    The following _CastError was thrown during method call TextInputClient.performPrivateCommand:
    Null check operator used on a null value

    When the exception was thrown, this was the stack:
    #0 EditableTextState.performPrivateCommand (package:flutter/src/widgets/editable_text.dart:2155:31)
    #1 TextInput._handleTextInputInvocation (package:flutter/src/services/text_input.dart:1821:37)
    #2 TextInput._loudlyHandleTextInputInvocation (package:flutter/src/services/text_input.dart:1701:20)
    #3 MethodChannel._handleAsMethodCall (package:flutter/src/services/platform_channel.dart:536:55)
    #4 MethodChannel.setMethodCallHandler. (package:flutter/src/services/platform_channel.dart:529:34)
    #5 _DefaultBinaryMessenger.setMessageHandler. (package:flutter/src/services/binding.dart:387:35)
    #6 _invoke2 (dart:ui/hooks.dart:186:13)
    #7 _ChannelCallbackRecord.invoke (dart:ui/channel_buffers.dart:42:5)
    #8 _Channel.push (dart:ui/channel_buffers.dart:132:31)
    #9 ChannelBuffers.push (dart:ui/channel_buffers.dart:329:17)
    #10 PlatformDispatcher._dispatchPlatformMessage (dart:ui/platform_dispatcher.dart:599:22)
    #11 _dispatchPlatformMessage (dart:ui/hooks.dart:89:31)

    call:
    MethodCall(TextInputClient.performPrivateCommand, [1, {data: {}, action: Normal_Mode}])
    ════════════════════════════════════════════════════════════════════════════════════════════════════`

  11. github-actions commented on Oct 26, 2022

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  12. locked as resolved and limited conversation to collaborators on Oct 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    r: duplicateIssue is closed as a duplicate of an existing issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions