maheshj01 / searchfield

A highly customizable simple and easy to use flutter Widget to add a searchfield to your Flutter Application.This Widget allows you to search and select from list of suggestions.
MIT License
84 stars 63 forks source link

Failed assertion: line 171 pos 14: 'widget.value.value == nextValue' #178

Open maheshj01 opened 2 months ago

maheshj01 commented 2 months ago

Steps to Reproduce

  1. Search for a suggestion not present in suggestion list
  2. Hit Submit using enter key
  3. Delete chars in input until you see a suggestion list
  4. press the down arrow key

code sample

 Padding(
      padding: const EdgeInsets.all(8.0),
      child: SearchField<String>(
        maxSuggestionsInViewPort: 10,
        suggestionAction: SuggestionAction.unfocus,
        searchInputDecoration: SearchInputDecoration(
          hintText: 'Search',
          cursorColor: Colors.blue,
          border: OutlineInputBorder(
            borderRadius: BorderRadius.circular(10),
          ),
        ),
        onSuggestionTap: (SearchFieldListItem<String> item) {
          setState(() {
            selected = item.searchKey;
          });
        },
        suggestions: suggestions
            .map(
              (e) => SearchFieldListItem<String>(e,
                  item: e,
                  child: searchChild(e, isSelected: e == selected)),
            )
            .toList(),
      ),
    ),
Restarted application in 710ms.
flutter: submitted:Asdfsdfsfs
flutter: submitted:sdfdsfdssdfdsfsfd

════════ Exception caught by services library ══════════════════════════════════
The following assertion was thrown while processing the key message handler:
'package:flutter/src/widgets/undo_history.dart': Failed assertion: line 171 pos 14: 'widget.value.value == nextValue': is not true.

Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
  https://github.com/flutter/flutter/issues/new?template=2_bug.yml

When the exception was thrown, this was the stack:
#2      UndoHistoryState._update (package:flutter/src/widgets/undo_history.dart:171:14)
#3      UndoHistoryState.undo (package:flutter/src/widgets/undo_history.dart:123:7)
#4      UndoHistoryState._undoFromIntent (package:flutter/src/widgets/undo_history.dart:153:5)
#5      CallbackAction.invoke (package:flutter/src/widgets/actions.dart:597:39)
#6      _OverridableAction.invokeDefaultAction (package:flutter/src/widgets/actions.dart:1757:28)
#7      _OverridableActionMixin.invoke (package:flutter/src/widgets/actions.dart:1671:9)
#8      Action._invoke (package:flutter/src/widgets/actions.dart:336:19)
#9      ActionDispatcher.invokeActionIfEnabled (package:flutter/src/widgets/actions.dart:666:28)
#10     ShortcutManager.handleKeypress (package:flutter/src/widgets/shortcuts.dart:907:83)
#11     _ShortcutsState._handleOnKeyEvent (package:flutter/src/widgets/shortcuts.dart:1098:20)
#12     _HighlightModeManager.handleKeyMessage (package:flutter/src/widgets/focus_manager.dart:2112:29)
#13     KeyEventManager._dispatchKeyMessage (package:flutter/src/services/hardware_keyboard.dart:1103:34)
#14     KeyEventManager.handleRawKeyMessage (package:flutter/src/services/hardware_keyboard.dart:1175:17)
#15     BasicMessageChannel.setMessageHandler.<anonymous closure> (package:flutter/src/services/platform_channel.dart:235:49)
#16     _DefaultBinaryMessenger.setMessageHandler.<anonymous closure> (package:flutter/src/services/binding.dart:618:35)
#17     _invoke2 (dart:ui/hooks.dart:344:13)
#18     _ChannelCallbackRecord.invoke (dart:ui/channel_buffers.dart:45:5)
#19     _Channel.push (dart:ui/channel_buffers.dart:135:31)
#20     ChannelBuffers.push (dart:ui/channel_buffers.dart:343:17)
#21     PlatformDispatcher._dispatchPlatformMessage (dart:ui/platform_dispatcher.dart:750:22)
#22     _dispatchPlatformMessage (dart:ui/hooks.dart:257:31)
(elided 2 frames from class _AssertionError)

KeyMessage: KeyMessage([KeyDownEvent#f8259(physicalKey: PhysicalKeyboardKey#c222c(usbHidUsage: "0x0007001d", debugName: "Key Z"), logicalKey: LogicalKeyboardKey#5989a(keyId: "0x0000007a", keyLabel: "Z", debugName: "Key Z"), character: "z", timeStamp: 4:45:37.750200)])
════════════════════════════════════════════════════════════════════════════════
Reloaded 1 of 721 libraries in 683ms (compile: 48 ms, reload: 256 ms, reassemble: 241 ms).