searchable_dropdown
searchable_dropdown copied to clipboard
Duplicate GlobalKey detected in widget tree.
when try to select item in again and again in quickly, the error of duplicate global key is detected.
which version you are using ?
which version you are using ?
I tried by clone the repo and use with stable version.
which version of the lib are you using please
@salim-lachdhaf I'm getting a similar issue with dropdown_search: 5.0.2
.
I have a situation where I insert my own OverlayEntry
for a custom overlay.
In that overlay I use a DropdownSearch<T>()
with menu
as the presentation type.
I can put DropdownSearch
in the overlay, but opening it yields a wrong position for its overlay. It is also below my own overlay and not on top of it.
When I try to close the DropdownSearch
overlay, I get
══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
The following assertion was thrown while finalizing the widget tree:
Duplicate GlobalKey detected in widget tree.
The following GlobalKey was specified multiple times in the widget tree. This will lead to parts of
the widget tree being truncated unexpectedly, because the second time a key is seen, the previous
instance is moved to the new location. The key was:
- [LabeledGlobalKey<SelectionWidgetState<User>>#a483d]
This was determined by noticing that after the widget with the above global key was moved out of its
previous parent, that previous parent never updated during this frame, meaning that it either did
not update at all or updated before the widget was moved, in either case implying that it still
thinks that it should have a child with that global key.
The specific parent that did not update after having one or more children forcibly removed due to
GlobalKey reparenting is:
- DefaultTextStyle(debugLabel: (englishLike bodyMedium 2014).merge((blackRedwoodCity
bodyMedium).apply), inherit: false, color: Color(0xdd000000), family: Prompt, size: 14.0, weight:
400, baseline: alphabetic, decoration: TextDecoration.none, softWrap: wrapping at box width,
overflow: clip)
A GlobalKey can only be specified on one widget at a time in the widget tree.
When the exception was thrown, this was the stack:
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 251:49 throw_
packages/flutter/src/widgets/framework.dart 2991:15 <fn>
packages/flutter/src/widgets/framework.dart 3015:16 finalizeTree
packages/flutter/src/widgets/binding.dart 893:7 drawFrame
packages/flutter/src/rendering/binding.dart 370:5 [_handlePersistentFrameCallback]
packages/flutter/src/scheduler/binding.dart 1146:15 [_invokeFrameCallback]
packages/flutter/src/scheduler/binding.dart 1083:9 handleDrawFrame
packages/flutter/src/scheduler/binding.dart 997:5 [_handleDrawFrame]
lib/_engine/engine/platform_dispatcher.dart 1090:13 invoke
lib/_engine/engine/platform_dispatcher.dart 160:5 invokeOnDrawFrame
lib/_engine/engine/initialization.dart 194:45 <fn>
Since there is no inline
presentation type that does not create its own overlay, I'm going to have to write my own widget (which isn't really a big deal)
dropdown_search: 5.0.2.
======== Exception caught by widgets library ======================================================= The following assertion was thrown while finalizing the widget tree: Duplicate GlobalKey detected in widget tree.
The following GlobalKey was specified multiple times in the widget tree. This will lead to parts of the widget tree being truncated unexpectedly, because the second time a key is seen, the previous instance is moved to the new location. The key was:
- [LabeledGlobalKey<SelectionWidgetState<DataBeanStore>>#01926] This was determined by noticing that after the widget with the above global key was moved out of its previous parent, that previous parent never updated during this frame, meaning that it either did not update at all or updated before the widget was moved, in either case implying that it still thinks that it should have a child with that global key. The specific parent that did not update after having one or more children forcibly removed due to GlobalKey reparenting is:
- DefaultTextStyle(debugLabel: (tall bodyMedium 2014).merge(blackCupertino bodyMedium), inherit: false, color: Color(0xdd000000), family: .SF UI Text, size: 15.0, weight: 400, baseline: alphabetic, decoration: TextDecoration.none, softWrap: wrapping at box width, overflow: clip)
A GlobalKey can only be specified on one widget at a time in the widget tree.
When the exception was thrown, this was the stack:
#0 BuildOwner.finalizeTree.
(package:flutter/src/widgets/framework.dart:2991:15) #1 BuildOwner.finalizeTree (package:flutter/src/widgets/framework.dart:3016:8) #2 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:893:19) #3 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:370:5) #4 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1146:15) #5 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1083:9) #6 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:997:5) #10 _invoke (dart:ui/hooks.dart:151:10) #11 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:308:5) #12 _drawFrame (dart:ui/hooks.dart:115:31) (elided 3 frames from dart:async) =======================================
thank you for reporting that, could you past an complete reproductible code to analyse the issue ?
no reply => close