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

Error if pop a route in onTap #297

Open
dannylin108 opened this issue Mar 5, 2023 · 4 comments
Open

Error if pop a route in onTap #297

dannylin108 opened this issue Mar 5, 2023 · 4 comments

Comments

@dannylin108
Copy link

dannylin108 commented Mar 5, 2023

SpeedDialChild(
        // ...
        onTap: () => Navigator.pop(context),
    ),

this code causes error:

======== Exception caught by widgets library =======================================================
The following assertion was thrown while finalizing the widget tree:
An OverlayEntry must first be removed from the Overlay before dispose is called.
'package:flutter/src/widgets/overlay.dart':
Failed assertion: line 213 pos 12: '_overlay == null'

When the exception was thrown, this was the stack: 
#2      OverlayEntry.dispose (package:flutter/src/widgets/overlay.dart:213:12)
#3      _SpeedDialState.dispose (package:flutter_speed_dial/src/speed_dial.dart:253:26)
#4      StatefulElement.unmount (package:flutter/src/widgets/framework.dart:5179:11)
#5      _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1960:13)
#6      _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1958:7)
#7      SingleChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:6363:14)
#8      _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1956:13)
#9      _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1958:7)
[206 more]

flutter_speed_dial: 6.2.0
flutter: 3.7.6

@MrMineToons
Copy link

The error also happens to me, but with different use case.

Using go_router redirection and a screen that has SpeedDial with children function => GoRouter.pushNamed("my_screen").
Example: while requesting(http.get) informations for "my_screen" the user request token expired and need to login again, redirecting to login screen will cause this error.

Error
════════ Exception caught by widgets library ═══════════════════════════════════
The following assertion was thrown while finalizing the widget tree:
An OverlayEntry must first be removed from the Overlay before dispose is called.
'package:flutter/src/widgets/overlay.dart':
Failed assertion: line 213 pos 12: '_overlay == null'


When the exception was thrown, this was the stack
#2      OverlayEntry.dispose
#3      _SpeedDialState.dispose
#4      StatefulElement.unmount
#5      _InactiveElements._unmount
#6      _InactiveElements._unmount.<anonymous closure>
#7      SingleChildRenderObjectElement.visitChildren
#8      _InactiveElements._unmount
#9      _InactiveElements._unmount.<anonymous closure>
#10     ComponentElement.visitChildren
#11     _InactiveElements._unmount
#12     _InactiveElements._unmount.<anonymous closure>
#13     SingleChildRenderObjectElement.visitChildren
#14     _InactiveElements._unmount
#15     _InactiveElements._unmount.<anonymous closure>
#16     ComponentElement.visitChildren
#17     _InactiveElements._unmount
#18     _InactiveElements._unmount.<anonymous closure>
#19     MultiChildRenderObjectElement.visitChildren
#20     _InactiveElements._unmount
#21     _InactiveElements._unmount.<anonymous closure>
#22     ComponentElement.visitChildren
#23     _InactiveElements._unmount
#24     _InactiveElements._unmount.<anonymous closure>
#25     ComponentElement.visitChildren
#26     _InactiveElements._unmount
#27     _InactiveElements._unmount.<anonymous closure>
#28     ComponentElement.visitChildren
#29     _InactiveElements._unmount
#30     _InactiveElements._unmount.<anonymous closure>
#31     MultiChildRenderObjectElement.visitChildren
#32     _InactiveElements._unmount
#33     _InactiveElements._unmount.<anonymous closure>
#34     ComponentElement.visitChildren
#35     _InactiveElements._unmount
#36     _InactiveElements._unmount.<anonymous closure>
#37     ComponentElement.visitChildren
#38     _InactiveElements._unmount
#39     _InactiveElements._unmount.<anonymous closure>
#40     ComponentElement.visitChildren
#41     _InactiveElements._unmount
#42     _InactiveElements._unmount.<anonymous closure>
#43     ComponentElement.visitChildren
#44     _InactiveElements._unmount
#45     _InactiveElements._unmount.<anonymous closure>
#46     ComponentElement.visitChildren
#47     _InactiveElements._unmount
#48     _InactiveElements._unmount.<anonymous closure>
#49     SingleChildRenderObjectElement.visitChildren
#50     _InactiveElements._unmount
#51     _InactiveElements._unmount.<anonymous closure>
#52     ComponentElement.visitChildren
#53     _InactiveElements._unmount
#54     _InactiveElements._unmount.<anonymous closure>
#55     SingleChildRenderObjectElement.visitChildren
#56     _InactiveElements._unmount
#57     _InactiveElements._unmount.<anonymous closure>
#58     ComponentElement.visitChildren
#59     _InactiveElements._unmount
#60     _InactiveElements._unmount.<anonymous closure>
#61     ComponentElement.visitChildren
#62     _InactiveElements._unmount
#63     _InactiveElements._unmount.<anonymous closure>
#64     ComponentElement.visitChildren
#65     _InactiveElements._unmount
#66     _InactiveElements._unmount.<anonymous closure>
#67     ComponentElement.visitChildren
#68     _InactiveElements._unmount
#69     _InactiveElements._unmount.<anonymous closure>
#70     ComponentElement.visitChildren
#71     _InactiveElements._unmount
#72     _InactiveElements._unmount.<anonymous closure>
#73     ComponentElement.visitChildren
#74     _InactiveElements._unmount
#75     _InactiveElements._unmount.<anonymous closure>
#76     ComponentElement.visitChildren
#77     _InactiveElements._unmount
#78     _InactiveElements._unmount.<anonymous closure>
#79     ComponentElement.visitChildren
#80     _InactiveElements._unmount
#81     _InactiveElements._unmount.<anonymous closure>
#82     ComponentElement.visitChildren
#83     _InactiveElements._unmount
#84     _InactiveElements._unmount.<anonymous closure>
#85     ComponentElement.visitChildren
#86     _InactiveElements._unmount
#87     _InactiveElements._unmount.<anonymous closure>
#88     SingleChildRenderObjectElement.visitChildren
#89     _InactiveElements._unmount
#90     _InactiveElements._unmount.<anonymous closure>
#91     ComponentElement.visitChildren
#92     _InactiveElements._unmount
#93     _InactiveElements._unmount.<anonymous closure>
#94     SingleChildRenderObjectElement.visitChildren
#95     _InactiveElements._unmount
#96     _InactiveElements._unmount.<anonymous closure>
#97     SingleChildRenderObjectElement.visitChildren
#98     _InactiveElements._unmount
#99     _InactiveElements._unmount.<anonymous closure>
#100    ComponentElement.visitChildren
#101    _InactiveElements._unmount
#102    _InactiveElements._unmount.<anonymous closure>
#103    SingleChildRenderObjectElement.visitChildren
#104    _InactiveElements._unmount
#105    _InactiveElements._unmount.<anonymous closure>
#106    ComponentElement.visitChildren
#107    _InactiveElements._unmount
#108    _InactiveElements._unmount.<anonymous closure>
#109    SingleChildRenderObjectElement.visitChildren
#110    _InactiveElements._unmount
#111    _InactiveElements._unmount.<anonymous closure>
#112    ComponentElement.visitChildren
#113    _InactiveElements._unmount
#114    _InactiveElements._unmount.<anonymous closure>
#115    ComponentElement.visitChildren
#116    _InactiveElements._unmount
#117    _InactiveElements._unmount.<anonymous closure>
#118    SingleChildRenderObjectElement.visitChildren
#119    _InactiveElements._unmount
#120    _InactiveElements._unmount.<anonymous closure>
#121    ComponentElement.visitChildren
#122    _InactiveElements._unmount
#123    _InactiveElements._unmount.<anonymous closure>
#124    SingleChildRenderObjectElement.visitChildren
#125    _InactiveElements._unmount
#126    _InactiveElements._unmount.<anonymous closure>
#127    ComponentElement.visitChildren
#128    _InactiveElements._unmount
#129    _InactiveElements._unmount.<anonymous closure>
#130    ComponentElement.visitChildren
#131    _InactiveElements._unmount
#132    _InactiveElements._unmount.<anonymous closure>
#133    ComponentElement.visitChildren
#134    _InactiveElements._unmount
#135    _InactiveElements._unmount.<anonymous closure>
#136    ComponentElement.visitChildren
#137    _InactiveElements._unmount
#138    _InactiveElements._unmount.<anonymous closure>
#139    SingleChildRenderObjectElement.visitChildren
#140    _InactiveElements._unmount
#141    _InactiveElements._unmount.<anonymous closure>
#142    ComponentElement.visitChildren
#143    _InactiveElements._unmount
#144    _InactiveElements._unmount.<anonymous closure>
#145    SingleChildRenderObjectElement.visitChildren
#146    _InactiveElements._unmount
#147    _InactiveElements._unmount.<anonymous closure>
#148    ComponentElement.visitChildren
#149    _InactiveElements._unmount
#150    _InactiveElements._unmount.<anonymous closure>
#151    ComponentElement.visitChildren
#152    _InactiveElements._unmount
#153    _InactiveElements._unmount.<anonymous closure>
#154    ComponentElement.visitChildren
#155    _InactiveElements._unmount
#156    _InactiveElements._unmount.<anonymous closure>
#157    ComponentElement.visitChildren
#158    _InactiveElements._unmount
#159    _InactiveElements._unmount.<anonymous closure>
#160    ComponentElement.visitChildren
#161    _InactiveElements._unmount
#162    _InactiveElements._unmount.<anonymous closure>
#163    ComponentElement.visitChildren
#164    _InactiveElements._unmount
#165    _InactiveElements._unmount.<anonymous closure>
#166    SingleChildRenderObjectElement.visitChildren
#167    _InactiveElements._unmount
#168    _InactiveElements._unmount.<anonymous closure>
#169    ComponentElement.visitChildren
#170    _InactiveElements._unmount
#171    _InactiveElements._unmount.<anonymous closure>
#172    ComponentElement.visitChildren
#173    _InactiveElements._unmount
#174    _InactiveElements._unmount.<anonymous closure>
#175    ComponentElement.visitChildren
#176    _InactiveElements._unmount
#177    _InactiveElements._unmount.<anonymous closure>
#178    ComponentElement.visitChildren
#179    _InactiveElements._unmount
#180    _InactiveElements._unmount.<anonymous closure>
#181    ComponentElement.visitChildren
#182    _InactiveElements._unmount
#183    _InactiveElements._unmount.<anonymous closure>
#184    SingleChildRenderObjectElement.visitChildren
#185    _InactiveElements._unmount
#186    _InactiveElements._unmount.<anonymous closure>
#187    ComponentElement.visitChildren
#188    _InactiveElements._unmount
#189    _InactiveElements._unmount.<anonymous closure>
#190    ComponentElement.visitChildren
#191    _InactiveElements._unmount
#192    _InactiveElements._unmount.<anonymous closure>
#193    ComponentElement.visitChildren
#194    _InactiveElements._unmount
#195    _InactiveElements._unmount.<anonymous closure>
#196    MultiChildRenderObjectElement.visitChildren
#197    _InactiveElements._unmount
#198    _InactiveElements._unmount.<anonymous closure>
#199    ComponentElement.visitChildren
#200    _InactiveElements._unmount
#201    _InactiveElements._unmount.<anonymous closure>
#202    ComponentElement.visitChildren
#203    _InactiveElements._unmount
#204    _InactiveElements._unmount.<anonymous closure>
#205    ComponentElement.visitChildren
#206    _InactiveElements._unmount
#207    _InactiveElements._unmount.<anonymous closure>
#208    ComponentElement.visitChildren
#209    _InactiveElements._unmount
#210    _InactiveElements._unmount.<anonymous closure>
#211    ComponentElement.visitChildren
#212    _InactiveElements._unmount
#213    _InactiveElements._unmount.<anonymous closure>
#214    ComponentElement.visitChildren
#215    _InactiveElements._unmount
#216    _InactiveElements._unmount.<anonymous closure>
#217    ComponentElement.visitChildren
#218    _InactiveElements._unmount
#219    _InactiveElements._unmount.<anonymous closure>
#220    ComponentElement.visitChildren
#221    _InactiveElements._unmount
#222    _InactiveElements._unmount.<anonymous closure>
#223    SingleChildRenderObjectElement.visitChildren
#224    _InactiveElements._unmount
#225    _InactiveElements._unmount.<anonymous closure>
#226    SingleChildRenderObjectElement.visitChildren
#227    _InactiveElements._unmount
#228    _InactiveElements._unmount.<anonymous closure>
#229    ComponentElement.visitChildren
#230    _InactiveElements._unmount
#231    _InactiveElements._unmount.<anonymous closure>
#232    ComponentElement.visitChildren
#233    _InactiveElements._unmount
#234    ListIterable.forEach (dart:_internal/iterable.dart:39:13)
#235    _InactiveElements._unmountAll
#236    BuildOwner.lockState
#237    BuildOwner.finalizeTree
#238    WidgetsBinding.drawFrame
#239    RendererBinding._handlePersistentFrameCallback
#240    SchedulerBinding._invokeFrameCallback
#241    SchedulerBinding.handleDrawFrame
#242    SchedulerBinding._handleDrawFrame
#243    _invoke (dart:ui/hooks.dart:145:13)
#244    PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:338:5)
#245    _drawFrame (dart:ui/hooks.dart:112:31)
(elided 2 frames from class _AssertionError)
════════════════════════════════════════════════════════════════════════════════

@prateekmedia
Copy link
Collaborator

prateekmedia commented Mar 11, 2023

I would suggest you to close the dial before doing something with the navigator.
https://github.com/darioielardi/flutter_speed_dial#how-to-use-openclosedial-property

@rostaingc
Copy link
Contributor

rostaingc commented Mar 27, 2023

This should be fixed with this PR I think
#286

Can we have a new release with the latest merged PRs ?

Thanks

@dannylin108
Copy link
Author

I would suggest you to close the dial before doing something with the navigator. https://github.com/darioielardi/flutter_speed_dial#how-to-use-openclosedial-property

it doesn't help in my case 🤷🏻‍♂️

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

4 participants