Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate GlobalKey detected in widget tree. #75

Open
rehman786waris opened this issue Dec 14, 2023 · 2 comments
Open

Duplicate GlobalKey detected in widget tree. #75

rehman786waris opened this issue Dec 14, 2023 · 2 comments

Comments

@rehman786waris
Copy link

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#1704b]
    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:
  • DefaultSelectionStyle
    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:3225:15)
    Add simple example #1 BuildOwner.finalizeTree (package:flutter/src/widgets/framework.dart:3250:8)
    Add name of original author #2 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:987:19)
    #3 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:457:5)
    Fix saving of images #4 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1325:15)
    Setting appBarColor does not work in some pages #5 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1255:9)
    App crash on iOS #6 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1113:5)
    Update permission handler to latest version #7 _invoke (dart:ui/hooks.dart:312:13)
    Add localization for texts in the image_editor_plus #8 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:383:5)
    Image is gone after filter is applied (white or black screen appears) #9 _drawFrame (dart:ui/hooks.dart:283:31)

ElevatedButton(
child: const Text("Multiple image editor"),
onPressed: () async {
var editedImage = await Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return ImageEditor(
images: [
imageData,
imageData,
],
);
}),
);
if (editedImage != null) {
image = editedImage;
setState(() {});
}
},
),

@miikhaaeel
Copy link

Any fix for this?

@knips-philip
Copy link

I faced a similar issue, and bumping to latest version (1.0.6) seems to have solved it.
For context, part of the changelog from 1.0.6

Removed global key use

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants