Beamer 1.4.1+1, BeamGuard, showPage, Stack Overflow Error

I am trying to implemenent BeamGuard with showPagebut this gives me stack overflow error.

Here’s _routerDelegatewhich is global:

final _routerDelegate = BeamerDelegate(
  initialPath: "https://stackoverflow.com/",
  locationBuilder: BeamerLocationBuilder(
    beamLocations: [
      HomeLocation(),
      // AuthLocation(),
    ],
  ),
  guards: <BeamGuard>[
    BeamGuard(
      pathPatterns: ["https://stackoverflow.com/"],
      check: (context, location) {
        return false;
      },
      showPage: BeamPage(child: AuthScreen(),), // <- stack overflow, adding Location doesn't help.
      // beamToNamed: (origin, target) => '/auth',
    ),
  ],
);

Without showPage, BeamGuard redirects me smoothly to AuthScreen().

Neither does Google seem to have an answer, nor StackOverflow. Documentation doesn’t help. (showPage requires BeamPageright?)

What would be a correct answer to implement BeamGuard with showPage?

Error Message:

[ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: Stack Overflow
#0      _StringBase.indexOf (dart:core-patch/string_patch.dart:351:3)
#1      _Uri._removeDotSegments (dart:core/uri.dart:2617:10)
#2      _Uri._normalizePath (dart:core/uri.dart:2352:12)
#3      _Uri._makePath (dart:core/uri.dart:2339:14)
#4      new _Uri (dart:core/uri.dart:1651:12)
#5      BeamState.configure (package:beamer/src/beam_state.dart:169:21)
#6      new BeamState (package:beamer/src/beam_state.dart:42:5)
#7      Utils.createBeamState (package:beamer/src/utils.dart:185:12)
#8      BeamLocation.create (package:beamer/src/beam_location.dart:152:13)
#9      new EmptyBeamLocation (package:beamer/src/beam_location.dart)
#10     BeamerDelegate._runGuards (package:beamer/src/beamer_delegate.dart:822:11)
#11     BeamerDelegate.update (package:beamer/src/beamer_delegate.dart:415:24)
#12     BeamGuard.apply (package:beamer/src/beam_guard.dart:116:18)
#13     BeamerDelegate._runGuards (package:beamer/src/beamer_delegate.dart:819:34)
#14     BeamerDelegate.update (package:beamer/src/beamer_delegate.dart:415:24)
#15     BeamGuard.apply (package:beamer/src/beam_guard.dart:116:18)
#16     BeamerDelegate._runGuards (package:beamer/src/beamer_delegate.dart:819:34)
#17     BeamerDelegate.update (package:beamer/src/beamer_delegate.dart:415:24)
#18     BeamGuard.apply (package:beamer/src/beam_guard.dart:116:18)
#19     BeamerDelegate._runGuards (package:beamer/src/beamer_delegate.dart:819:34)
#20     BeamerDelegate.update (package:beamer/src/beamer_delegate.dart:415:24)
#21     BeamGuard.apply (package:beamer/src/beam_guard.dart:116:18)
#22     BeamerDelegate._runGuards (package:beamer/src/beamer_delegate.dart:819:34)
#23     BeamerDelegate.update (package:beamer/src/beamer_delegate.dart:415:24)
#24     BeamGuard.apply (package:beamer/src/beam_guard.dart:116:18)
#25     BeamerDelegate._runGuards (package:beamer/src/beamer_delegate.dart:819:34)
#26     BeamerDelegate.update (package:beamer/src/beamer_delegate.dart:415:24)
#27     BeamGuard.apply (package:beamer/src/beam_guard.dart:116:18)
#28     BeamerDelegate._runGuards (package:beamer/src/beamer_delegate.dart:819:34)
#29     BeamerDelegate.update (package:beamer/src/beamer_delegate.dart:415:24)
#30     BeamGuard.apply (package:beamer/src/beam_guard.dart:116:18)
#31     BeamerDelegate._runGuards (package:beamer/src/beamer_delegate.dart:819:34)
#32     BeamerDelegate.update (package:beamer/src/beamer_delegate.dart:415:24)
#33     BeamGuard.apply (package:beamer/src/beam_guard.dart:116:18)
#34     BeamerDelegate._runGuards (package:beamer/src/beamer_delegate.dart:819:34)
#35     BeamerDelegate.update (package:beamer/src/beamer_delegate.dart:415:24)
#36     BeamGuard.apply (package:beamer/src/beam_guard.dart:116:18)
#37     BeamerDelegate._runGuards (package:beamer/src/beamer_delegate.dart:819:34)
#38     BeamerDelegate.update (package:beamer/src/beamer_delegate.dart:415:24)
#39     BeamGuard.apply (package:beamer/src/beam_guard.dart:116:18)
#40     BeamerDelegate._runGuards (package:beamer/src/beamer_delegate.dart:819:34)
#41     BeamerDelegate.update (package:beamer/src/beamer_delegate.dart:415:24)
#42     BeamGuard.apply (package:beamer/src/beam_guard.dart:116:18)
#43     BeamerDelegate._runGuards (package:beamer/src/beamer_delegate.dart:819:34)
...
...
#53076  Element.inflateWidget (package:flutter/src/widgets/framework.dart:3790:14)
#53077  Element.updateChild (package:flutter/src/widgets/framework.dart:3540:18)
#53078  ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4780:16)
#53079  Element.rebuild (package:flutter/src/widgets/framework.dart:4477:5)
#53080  ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4735:5)
#53081  ComponentElement.mount (package:flutter/src/widgets/framework.dart:4729:5)
#53082  Element.inflateWidget (package:flutter/src/widgets/framework.dart:3790:14)
#53083  Element.updateChild (package:flutter/src/widgets/framework.dart:3540:18)
#53084  SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6284:14)
#53085  Element.inflateWidget (package:flutter/src/widgets/framework.dart:3790:14)
#53086  Element.updateChild (package:flutter/src/widgets/framework.dart:3540:18)
#53087  ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4780:16)
#53088  Element.rebuild (package:flutter/src/widgets/framework.dart:4477:5)
#53089  ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4735:5)
#53090  ComponentElement.mount (package:flutter/src/widgets/framework.dart:4729:5)
#53091  Element.inflateWidget (package:flutter/src/widgets/framework.dart:3790:14)
#53092  MultiChildRenderObjectElement.inflateWidget (package:flutter/src/widgets/framework.dart:6422:36)
#53093  Element.updateChild (package:flutter/src/widgets/framework.dart:3540:18)
#53094  RenderObjectElement.updateChildren (package:flutter/src/widgets/framework.dart:5845:32)
#53095  MultiChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6445:17)
#53096  Element.updateChild (package:flutter/src/widgets/framework.dart:3501:15)
#53097  ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4780:16)
#53098  StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4928:11)
#53099  Element.rebuild (package:flutter/src/widgets/framework.dart:4477:5)
#53100  StatefulElement.update (package:flutter/src/widgets/framework.dart:4960:5)
#53101  Element.updateChild (package:flutter/src/widgets/framework.dart:3501:15)
#53102  ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4780:16)
#53103  StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4928:11)
#53104  Element.rebuild (package:flutter/src/widgets/framework.dart:4477:5)
#53105  BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2659:19)
#53106  WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:882:21)
#53107  RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:363:5)
#53108  SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1144:15)
#53109  SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1081:9)
#53110  SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:995:5)
#53111  _rootRun (dart:async/zone.dart:1426:13)
#53112  _CustomZone.run (dart:async/zone.dart:1328:19)
#53113  _CustomZone.runGuarded (dart:async/zone.dart:1236:7)
#53114  _invoke (dart:ui/hooks.dart:151:10)
#53115  PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:308:5)
#53116  _drawFrame (dart:ui/hooks.dart:115:31)



Flutter (Channel stable, 2.10.4, on Ubuntu 20.04.4 LTS 5.13.0-40-generic, locale en_US.UTF-8)

Leave a Comment