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

Changing only query param caused an exception #220

Open
rockingdice opened this issue Apr 27, 2021 · 12 comments
Open

Changing only query param caused an exception #220

rockingdice opened this issue Apr 27, 2021 · 12 comments
Labels
bug Something isn't working
Milestone

Comments

@rockingdice
Copy link

Met an issue after upgrading to 0.12.3.
I want to change the navigation from a DropdownButton:

 DropdownButton<int>(
        value: selectedAppId,
        icon: Icon(Icons.arrow_drop_down),
        iconEnabledColor: Colors.black,
        iconSize: 12,
        elevation: 16,
        dropdownColor: Colors.white,
        isExpanded: true,
        underline: Container(),
        onChanged: (int? newValue) {
          selectedAppId = newValue;
          Beamer.of(context).beamToNamed("/main/app-edit?id=${selectedAppId}");
        },
        items: items,
      )

Only the query param is changed, and I'll get an exception:


════════ Exception caught by widgets library ═══════════════════════════════════
The following assertion was thrown building Builder(dependencies: [_RouterScope]):
Assertion failed:
../…/widgets/navigator.dart:3237
!isWaitingForEnteringDecision && isWaitingForExitingDecision && isPresent
"This route cannot be marked for remove. Either a decision has already been made or it does not require an explicit decision on how to transition out."

Don't know how to deal with the exception..

I'm using SimpleLocationBuilder.

@rockingdice
Copy link
Author

Seems the issue is related to an overlay. I used the package:
https://pub.dev/packages/select_dialog

It also raises the same exception when choosing from the dialog.

It won't throws exceptions if I just tapped a button from the page(no overlay).

@slovnicki slovnicki added the bug Something isn't working label Apr 29, 2021
@slovnicki
Copy link
Owner

Hi @rockingdice
Thanks for creating an issue.

I will need to investigate this further. Can you provide a minimal example that demonstrates this bug?

@rockingdice
Copy link
Author

rockingdice commented May 4, 2021

@slovnicki OK, after vacation I'll try to make one for you.

@MarkAlexanderDev
Copy link

Hey @slovnicki! Got the same issue with PopupMenuItem. Here's an example that demonstrates the bug: https://github.com/MarkAlexanderDev/beamer_issue

@MarkAlexanderDev
Copy link

Here's a temporary fix :

PopupMenuItem<String>(
                          child: Text(
                            "Random text",
                          ),
                          onTap: () async {
                            Future.delayed(const Duration(milliseconds: 500))
                                .then((value) => Beamer.of(context).beamToNamed("/url"));
                          },
                        ),

@mhbdev
Copy link

mhbdev commented Apr 30, 2022

Are you kidding? When would you fix this issue? Should use Future.delayed everywhere I need to beamToNamed?

@slovnicki
Copy link
Owner

@mhbdev This might have been closed prematurely.
I will reopen and investigate the issue.

@slovnicki slovnicki reopened this May 2, 2022
@slovnicki slovnicki added this to the v1.5.0 milestone May 2, 2022
@slovnicki slovnicki modified the milestones: v1.5, v2 Jun 10, 2022
@wenchaosong
Copy link

@mhbdev This might have been closed prematurely. I will reopen and investigate the issue.

Are you working on this? I got the same error, and use

   Future.delayed(const Duration(milliseconds: 500))
   .then((value) => Beamer.of(context).beamToNamed("/url"));

fix it, but I think it should be fixed in other way

@Wackymax
Copy link

Just ran into the same issue. Any updates yet?

@mhbdev
Copy link

mhbdev commented May 20, 2023

@Wackymax @wenchaosong

I would suggest migrating to go_router or auto_route

@stan-at-work
Copy link

@slovnicki Any update on this, this is a mayor issue.

TLTR: I think you should check on a magic may if every animation is done or all the controllers on a page are disposed/done, or w8t until the next frame until you navigate rsmting like that idk sorry... ;-)
I always keeps seeing somthing comming back reguarding The AnimationController notifying status listeners was:
flutter: AnimationController#df15c(⏮ 0.000; paused; for DialogRoute<ApprovalResult?>)
so somthing is up with a animationcontroller...

I have this problem in my 3 flutter apps, in all three i need to apply an Future.delayed(const Duration(milliseconds: 500))... this is a very ugly fix and this needs to be fixed asap.

The issue only exists in debug mode but it makes developing a nightmare... 👾

Here are some details on the error, hopefully you have found a solution since the first mention on Apr 27, 2021...

This is NOT a dialog only problem, this is a global widgets problem.

Here is some video proof:
test

Code that triggers error

approvalUiState.updateWith(
  purchaseInvoiceId: '',
  flowInstanceId: '',
);

Currently i FiXeD it using this peace of code:

Future.delayed(const Duration(milliseconds: kDebugMode ? 200 : 0), () {
  approvalUiState.updateWith(
    purchaseInvoiceId: '',
    flowInstanceId: '',
  );
});

Stack:

flutter: ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
flutter: The following assertion was thrown building Builder(dependencies: [MediaQuery]):
flutter: This route cannot be marked for remove. Either a decision has already been made or it does not
flutter: require an explicit decision on how to transition out.
flutter: 'package:flutter/src/widgets/navigator.dart':
navigator.dart:1
flutter: Failed assertion: line 3207 pos 7: '!isWaitingForEnteringDecision && isWaitingForExitingDecision &&
flutter: isPresent'
flutter:
flutter: The relevant error-causing widget was:
flutter: Builder
flutter:
core_providers.dart:106
flutter:
flutter: When the exception was thrown, this was the stack:
flutter: #2 _RouteEntry.markForRemove
navigator.dart:3207
flutter: #3 NoAnimationTransitionDelegate.resolve
transition_delegates.dart:32
flutter: #4 TransitionDelegate._transition
navigator.dart:858
flutter: #5 NavigatorState._updatePages
navigator.dart:3932
flutter: #6 NavigatorState.didUpdateWidget
navigator.dart:3605
flutter: #7 StatefulElement.update
framework.dart:5471
flutter: #8 Element.updateChild
framework.dart:3685
flutter: #9 ComponentElement.performRebuild
framework.dart:5322
flutter: #10 Element.rebuild
framework.dart:5016
flutter: #11 StatelessElement.update
framework.dart:5373
flutter: #12 Element.updateChild
framework.dart:3685
flutter: #13 ComponentElement.performRebuild
framework.dart:5322
flutter: #14 Element.rebuild
framework.dart:5016
flutter: #15 StatelessElement.update
framework.dart:5373
flutter: #16 Element.updateChild
framework.dart:3685
flutter: #17 ComponentElement.performRebuild
framework.dart:5322
flutter: #18 Element.rebuild
framework.dart:5016
flutter: #19 ProxyElement.update
framework.dart:5628
flutter: #20 _InheritedProviderScopeElement.update
inherited_provider.dart:523
flutter: #21 Element.updateChild
framework.dart:3685
flutter: #22 ComponentElement.performRebuild
framework.dart:5322
flutter: #23 Element.rebuild
framework.dart:5016
flutter: #24 StatelessElement.update
framework.dart:5373
flutter: #25 Element.updateChild
framework.dart:3685
flutter: #26 ComponentElement.performRebuild
framework.dart:5322
flutter: #27 Element.rebuild
framework.dart:5016
flutter: #28 BuildOwner.buildScope
framework.dart:2779
flutter: #29 WidgetsBinding.drawFrame
binding.dart:916
flutter: #30 RendererBinding._handlePersistentFrameCallback
binding.dart:360
flutter: #31 SchedulerBinding._invokeFrameCallback
binding.dart:1299
flutter: #32 SchedulerBinding.handleDrawFrame
binding.dart:1230
flutter: #33 SchedulerBinding._handleDrawFrame
binding.dart:1088
flutter: #37 _invoke (dart:ui/hooks.dart:172:10)
flutter: #38 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:401:5)
flutter: #39 _drawFrame (dart:ui/hooks.dart:140:31)
flutter: (elided 5 frames from class _AssertionError and dart:async)
flutter:
flutter: ════════════════════════════════════════════════════════════════════════════════════════════════════
flutter: ══╡ EXCEPTION CAUGHT BY ANIMATION LIBRARY ╞═════════════════════════════════════════════════════════
flutter: The following assertion was thrown while notifying status listeners for AnimationController:
flutter: 'package:flutter/src/widgets/navigator.dart': Failed assertion: line 3968 pos 12: '_debugLocked &&
navigator.dart:3968
flutter: !_debugUpdatingPage': is not true.
flutter:
flutter: Either the assertion indicates an error in the framework itself, or we should provide substantially
flutter: more information in this error message to help you determine and fix the underlying cause.
flutter: In either case, please report this assertion by filing a bug on GitHub:
flutter: https://github.com/flutter/flutter/issues/new?template=2_bug.yml
flutter:
flutter: When the exception was thrown, this was the stack:
flutter: #2 NavigatorState._flushHistoryUpdates
navigator.dart:3968
flutter: #3 NavigatorState.finalizeRoute
navigator.dart:5176
flutter: #4 TransitionRoute._handleStatusChanged
routes.dart:252
flutter: #5 AnimationLocalStatusListenersMixin.notifyStatusListeners
listener_helpers.dart:240
flutter: #6 AnimationController._checkStatusChanged
animation_controller.dart:815
flutter: #7 AnimationController._tick
animation_controller.dart:831
flutter: #8 Ticker._tick
ticker.dart:249
flutter: #9 SchedulerBinding._invokeFrameCallback
binding.dart:1299
flutter: #10 SchedulerBinding.handleBeginFrame.
binding.dart:1152
flutter: #11 _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:625:13)
flutter: #12 SchedulerBinding.handleBeginFrame
binding.dart:1150
flutter: #13 SchedulerBinding._handleBeginFrame
binding.dart:1067
flutter: #17 _invoke1 (dart:ui/hooks.dart:188:10)
flutter: #18 PlatformDispatcher._beginFrame (dart:ui/platform_dispatcher.dart:379:5)
flutter: #19 _beginFrame (dart:ui/hooks.dart:129:31)
flutter: (elided 5 frames from class _AssertionError and dart:async)
flutter:
flutter: The AnimationController notifying status listeners was:
flutter: AnimationController#df15c(⏮ 0.000; paused; for DialogRoute<ApprovalResult?>)
flutter: ════════════════════════════════════════════════════════════════════════════════════════════════════

@stan-at-work
Copy link

stan-at-work commented Oct 31, 2023

@slovnicki Any update on this, this is a mayor issue.
#645

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants