We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Yes.
When supplying a StackedRouteGuard to routes in app.dart
StackedRouteGuard
app.dart
class TestGuard extends StackedRouteGuard { final databaseService = locator<DatabaseService>(); // <=== This breaks when running for mobile apps @override void onNavigation(NavigationResolver resolver, StackRouter router) {} } @StackedApp( routes: [ CustomRoute(page: StartupView, initial: true), CustomRoute(page: MainView, guards: [TestGuard]), // @stacked-route CustomRoute(page: UnknownView, path: '/404'), /// When none of the above routes match, redirect to UnknownView RedirectRoute(path: '*', redirectTo: '/404'), ], .... ) class App {}
It generates the router as follows
final stackedRouter = StackedRouterWeb( navigatorKey: _i6.StackedService.navigatorKey, testGuard: _i7.TestGuard(), );
If you run on web this works. When you run it on mobile apps this break because the router is constructed before the locator code is run.
The generator should instead generate something like this:
final stackedRouter = StackedRouterWeb( navigatorKey: _i6.StackedService.navigatorKey, testGuardBuilder: () => _i7.TestGuard(), );
Which would be built when the page is accessed
No response
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Is your feature request related to a problem? Please describe.
Yes.
When supplying a
StackedRouteGuard
to routes inapp.dart
It generates the router as follows
If you run on web this works.
When you run it on mobile apps this break because the router is constructed before the locator code is run.
Describe the solution you would like
The generator should instead generate something like this:
Which would be built when the page is accessed
Additional Context
No response
The text was updated successfully, but these errors were encountered: