go_router_plus library

Building blocks screen, access control, refresh notifiers base on Go Router.

Classes

AuthRedirector
Redirect user base on LoggedInState.
ChainRedirector
Chain redirector
CustomTransitionPage<T>
Page with custom transition functionality.
ErrorScreen
An interface to mark screen as an error screen.
GoRoute Configuration Get started Named routes Redirection Transition animations
A route that is displayed visually above the matching parent route using the Navigator.
GoRouteData Type-safe routes
Baseclass for supporting Type-safe routing.
GoRouter Configuration Deep linking Error handling Get started Named routes Navigation Redirection Upgrading Web
The route configuration for the app.
GoRouterState
The route state during routing.
GuestScreen
Implements by screens for guest user (not logged-in) LoggedInState.loggedIn is false.
InheritedGoRouter
GoRouter implementation of InheritedWidget.
InitialScreen
An interface to mark screen as an initial screen (first screen).
LoggedInState
Represent for user state (logged-in system or not).
NoTransitionPage<T>
Custom transition page with no transition.
RedirectAware
Implements by screens want to control redirect flow by itself.
Redirector
Redirector responsible to redirect end-user to another screen in cases they don't have permission to access the screen or app states are invalid.
RestrictRedirector
Redirector can restrict redirect screen depends on result of shouldRedirect method.
RouteBase
The base class for GoRoute and ShellRoute.
RouteData
A superclass for each route data
Screen
Abstract class extends by app screens.
ScreenBase
Screen base defining common logic of screens.
ScreenController
Collect and analyze list of ScreenBase to detect initial screen, error screen and control redirect of routes by using Redirector.
ScreenRedirector
Redirector support screens aware redirect by itself.
ShellRoute Configuration
A route that displays a UI shell around the matching child route.
ShellRouteData
Base class for supporting nested navigation
ShellScreen
Nested navigation screen base on ShellRoute
TypedGoRoute<T extends GoRouteData>
A superclass for each typed go route descendant
TypedRoute<T extends RouteData>
A superclass for each typed route descendant
TypedShellRoute<T extends ShellRouteData>
A superclass for each typed shell route descendant
UserScreen
Implements by screens for logged-in user LoggedInState.loggedIn is true.

Extensions

GoRouterHelper on BuildContext
Dart extension to add navigation function to a BuildContext object, e.g. context.go('/');

Functions

createGoRouter({required List<ScreenBase> screens, List<Redirector>? redirectors, List<Listenable>? refreshNotifiers, bool routerNeglect = false, int redirectLimit = 8, List<NavigatorObserver>? observers, bool debugLogDiagnostics = false, String? restorationScopeId, GlobalKey<NavigatorState>? navigatorKey, Object? initialExtra}) GoRouter
Factory function to create Go Router with extra logics like ScreenBases, Redirectors, and refresh router notifiers.

Typedefs

GoRouterPageBuilder = Page Function(BuildContext context, GoRouterState state)
The page builder for GoRoute.
GoRouterRedirect = FutureOr<String?> Function(BuildContext context, GoRouterState state)
The signature of the redirect callback.
GoRouterWidgetBuilder = Widget Function(BuildContext context, GoRouterState state)
The widget builder for GoRoute.

Exceptions / Errors

DuplicateScreenException
An exception will be throw in cases screens with the same type providing more than once.
InvalidBuilderException
An exception will be throw when classes implementing Screen have a Screen.build returning invalid types.
UnexpectedScreenException
An exception will be throw when receive unexpected screen.