super_editor
super_editor copied to clipboard
Editor crashes if first character typed is an emoji, when plugged with pattern, stable or action tags plugin
Package Version GitHub, stable branch
To Reproduce Steps to reproduce the behavior:
- Run the example and open "In the Lab" Hash Tags, User Tags or Action Tags page
- Type an emoji as your first character, e.g: 💙
- Editor doesn't display the character and no longer accept any other user input
See error:
════════ Exception caught by services library ══════════════════════════════════
The following _TypeError was thrown during method call TextInputClient.updateEditingStateWithDeltas:
Null check operator used on a null value
When the exception was thrown, this was the stack:
#0 TagFinder.findTagAroundPosition (package:super_editor/src/default_editor/text_tokenizing/tags.dart:40:95)
tags.dart:40
#1 PatternTagReaction._findTagAtCaret (package:super_editor/src/default_editor/text_tokenizing/pattern_tags.dart:292:22)
pattern_tags.dart:292
#2 PatternTagReaction._adjustTagAttributionsAroundAlteredTags (package:super_editor/src/default_editor/text_tokenizing/pattern_tags.dart:244:17)
pattern_tags.dart:244
#3 PatternTagReaction.react (package:super_editor/src/default_editor/text_tokenizing/pattern_tags.dart:218:5)
pattern_tags.dart:218
#4 Editor._reactToChanges (package:super_editor/src/core/editor.dart:218:16)
editor.dart:218
#5 Editor.execute (package:super_editor/src/core/editor.dart:161:9)
editor.dart:161
#6 TextDeltasDocumentEditor._insertPlainText (package:super_editor/src/default_editor/document_ime/document_delta_editing.dart:342:12)
document_delta_editing.dart:342
#7 TextDeltasDocumentEditor.insert (package:super_editor/src/default_editor/document_ime/document_delta_editing.dart:294:23)
document_delta_editing.dart:294
#8 TextDeltasDocumentEditor._applyInsertion (package:super_editor/src/default_editor/document_ime/document_delta_editing.dart:171:5)
document_delta_editing.dart:171
#9 TextDeltasDocumentEditor.applyDeltas (package:super_editor/src/default_editor/document_ime/document_delta_editing.dart:80:9)
document_delta_editing.dart:80
#10 DocumentImeInputClient.updateEditingValueWithDeltas (package:super_editor/src/default_editor/document_ime/document_ime_communication.dart:219:30)
document_ime_communication.dart:219
#11 DeltaTextInputClientDecorator.updateEditingValueWithDeltas (package:super_editor/src/default_editor/document_ime/ime_decoration.dart:124:14)
ime_decoration.dart:124
#12 TextInput._handleTextInputInvocation (package:flutter/src/services/text_input.dart:1876:63)
text_input.dart:1876
#13 TextInput._loudlyHandleTextInputInvocation (package:flutter/src/services/text_input.dart:1765:20)
text_input.dart:1765
#14 MethodChannel._handleAsMethodCall (package:flutter/src/services/platform_channel.dart:571:55)
platform_channel.dart:571
#15 MethodChannel.setMethodCallHandler.<anonymous closure> (package:flutter/src/services/platform_channel.dart:564:34)
platform_channel.dart:564
#16 _DefaultBinaryMessenger.setMessageHandler.<anonymous closure> (package:flutter/src/services/binding.dart:603:35)
binding.dart:603
#17 _invoke2 (dart:ui/hooks.dart:344:13)
hooks.dart:344
#18 _ChannelCallbackRecord.invoke (dart:ui/channel_buffers.dart:45:5)
channel_buffers.dart:45
#19 _Channel.push (dart:ui/channel_buffers.dart:135:31)
channel_buffers.dart:135
#20 ChannelBuffers.push (dart:ui/channel_buffers.dart:343:17)
channel_buffers.dart:343
#21 PlatformDispatcher._dispatchPlatformMessage (dart:ui/platform_dispatcher.dart:737:22)
platform_dispatcher.dart:737
#22 _dispatchPlatformMessage (dart:ui/hooks.dart:257:31)
hooks.dart:257
call: MethodCall(TextInputClient.updateEditingStateWithDeltas, [1, {deltas: [{selectionBase: 4, oldText: . , selectionAffinity: TextAffinity.downstream, deltaEnd: 2, deltaText: 💙, deltaStart: 2, composingExtent: -1, selectionIsDirectional: false, selectionExtent: 4, composingBase: -1}]}])
════════════════════════════════════════════════════════════════════════════════
Actual behavior What's the result of repeating the steps above?
Expected behavior What should be the result of repeating the steps above (the desired behavior)?
Platform mobile and desktop
Flutter version Tested with 3.16 and 3.19