singerdmx / flutter-quill

Rich text editor for Flutter
https://pub.dev/packages/flutter_quill
MIT License
2.43k stars 767 forks source link

The following _CastError was thrown while dispatching notifications for QuillController #1240

Open yossefEl opened 1 year ago

yossefEl commented 1 year ago

My issue is about [Mobile] I'm using the futter version 3.7.11 and flutter_quill package version 7.1.16

I have two quill editors inside a stack, each one takes half the screen height and the first one is on the top center and the second is bottom center When I open the keyboard for one of them the other disappears and I can switch between them. So the following issue happens at some point and I have no idea why πŸ˜Άβ€πŸŒ«οΈ

flutter: The following _CastError was thrown while dispatching notifications for QuillController:
flutter: Null check operator used on a null value
flutter:
flutter: When the exception was thrown, this was the stack:
flutter: #0      RawEditorState.renderEditor                     raw_editor.dart:1325
flutter: #1      RawEditorStateTextInputClientMixin._updateSizeAndTransform       raw_editor_state_text_input_client_mixin.dart:310
flutter: #2      RawEditorStateTextInputClientMixin.openConnectionIfNeeded       raw_editor_state_text_input_client_mixin.dart:63
flutter: #3      RawEditorState.requestKeyboard                             raw_editor.dart:1342
flutter: #4      RawEditorState._didChangeTextEditingValue              raw_editor.dart:1170
flutter: #5      RawEditorState.initState.<anonymous closure>                raw_editor.dart:1003
flutter: #6      ChangeNotifier.notifyListeners                   change_notifier.dart:381
flutter: #7      QuillController.replaceText                            controller.dart:288
flutter: #8      RawEditorStateTextInputClientMixin.updateEditingValue  raw_editor_state_text_input_client_mixin.dart:178
flutter: #9      TextInput._updateEditingValue                                         text_input.dart:2029
flutter: #10     TextInput._handleTextInputInvocation                                text_input.dart:1854
flutter: #11     TextInput._loudlyHandleTextInputInvocation                    text_input.dart:1753
flutter: #12     MethodChannel._handleAsMethodCall                                         platform_channel.dart:555
flutter: #13     MethodChannel.setMethodCallHandler.<anonymous closure>   platform_channel.dart:548
flutter: #14     _DefaultBinaryMessenger.setMessageHandler.<anonymous closure>.     binding.dart:393
flutter: #15     _invoke2 (dart:ui/hooks.dart:183:13)
flutter: #16     _ChannelCallbackRecord.invoke (dart:ui/channel_buffers.dart:40:5)
flutter: #17     _Channel.push (dart:ui/channel_buffers.dart:130:31)
flutter: #18     ChannelBuffers.push (dart:ui/channel_buffers.dart:326:17)
flutter: #19     PlatformDispatcher._dispatchPlatformMessage (dart:ui/platform_dispatcher.dart:664:22)
flutter: #20     _dispatchPlatformMessage (dart:ui/hooks.dart:86:31)
flutter:
flutter: The QuillController sending notification was:
flutter:   Instance of 'QuillController'

$ flutter doctor

[βœ“] Flutter (Channel stable, 3.7.11, on macOS 13.3.1 22E772610a darwin-arm64, locale en-HU)
[βœ“] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
[βœ“] Xcode - develop for iOS and macOS (Xcode 14.3)
[βœ“] Chrome - develop for the web
[βœ“] Android Studio (version 2022.2)
[βœ“] VS Code (version 1.78.1)
[βœ“] Connected device (3 available)
[βœ“] HTTP Host Availability

β€’ No issues found!
adil192 commented 2 weeks ago

I'm also getting this on flutter_quill: 9.4.1 and Flutter 3.22.2:

  ══║ EXCEPTION CAUGHT BY FOUNDATION LIBRARY β•žβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
  The following _TypeError was thrown while dispatching notifications for FocusNode:
  Null check operator used on a null value

  When the exception was thrown, this was the stack:
  #0      QuillRawEditorState.renderEditor (package:flutter_quill/src/widgets/raw_editor/raw_editor_state.dart:1444:32)
  #1      RawEditorStateTextInputClientMixin._updateSizeAndTransform (package:flutter_quill/src/widgets/raw_editor/raw_editor_state_text_input_client_mixin.dart:356:20)
  #2      RawEditorStateTextInputClientMixin.openConnectionIfNeeded (package:flutter_quill/src/widgets/raw_editor/raw_editor_state_text_input_client_mixin.dart:77:7)
  #3      RawEditorStateTextInputClientMixin.openOrCloseConnection (package:flutter_quill/src/widgets/raw_editor/raw_editor_state_text_input_client_mixin.dart:45:7)
  #4      QuillRawEditorState._handleFocusChanged (package:flutter_quill/src/widgets/raw_editor/raw_editor_state.dart:1365:5)
  #5      ChangeNotifier.notifyListeners (package:flutter/src/foundation/change_notifier.dart:433:24)
  #6      FocusNode._notify (package:flutter/src/widgets/focus_manager.dart:1090:5)
  #7      FocusManager.applyFocusChangesIfNeeded (package:flutter/src/widgets/focus_manager.dart:1850:12)
  (elided 8 frames from dart:async and package:stack_trace)

  The FocusNode sending notification was:
    FocusNode#dbc39(Quill Focus Node [PRIMARY FOCUS])
  ════════════════════════════════════════════════════════════════════════════════════════════════════