slovnicki / beamer

A routing package built on top of Router and Navigator's pages API, supporting arbitrary nested navigation, guards and more.
MIT License
591 stars 129 forks source link

!isWaitingForEnteringDecision && isWaitingForExitingDecision && flutter: isPresent #645

Closed stan-at-work closed 1 year ago

stan-at-work commented 1 year ago

To fix this issue make sure your transitionDelegate and beamBackTransitionDelegate are NOT SET TO 'NoAnimationTransitionDelegate()' in the beamerDelegate.

Example FIX:

beamerDelegate = BeamerDelegate(
  buildListener: (context, beamerDelegate) => CoreGlobalContext.key = beamerDelegate.navigatorKey,
  initialPath: initialPath,
  locationBuilder: (routeInformation, beamParameters) {
    return BeamerLocationBuilder(
      beamLocations: [
        ...this.customBeamLocations(routeInformation, beamParameters),
        CoreLoginLocation(
          environmentForm: this.environmentForm,
          loginBackgroundImagePath: this.loginBackgroundImagePath,
          qrCodeImageUrl: this.qrCodeImageUrl ?? '',
        ),
        CoreProfileLocation(drawer: this.drawer),
        CoreSettingsLocation(drawer: this.drawer, settingsForm: this.settingsForm),
        CoreLoadingLocation(),
        CoreNotFoundLocation(drawer: this.drawer),
      ],
    ).call(routeInformation, beamParameters);
  },
  //! ------------------------------------------DON'T ADD [transitionDelegate] AND [beamBackTransitionDelegate] IF YOU DO THE APPLICATION WILL BREAK------------------------------------------
  //!
  //! If you change it the application can throw !isWaitingForEnteringDecision && isWaitingForExitingDecision && flutter: isPresenting errors...
  //!
  //! ------------------------------------------DON'T ADD [transitionDelegate] AND [beamBackTransitionDelegate] IF YOU DO THE APPLICATION WILL BREAK------------------------------------------
  notFoundRedirectNamed: CoreNotFoundScreen.routeName,
  guards: [
    ...this.customBeamGuards,
    ...beamGuards.loginGuards,
    ...beamGuards.applicationConfigGuards,
  ],
);

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

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 all my flutter apps, in all i need to apply an Future.delayed(const Duration(milliseconds: 500))... this is an ugly fixbut bether than norhing 😙

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

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: ════════════════════════════════════════════════════════════════════════════════════════════════════