Skip to content

crm_sdk/go_router.dart

The routes for an app that routes with go_router.

import 'package:crm_sdk/go_router.dart';
NameWhat it is
GoRouterCrmNavigatorShows PurrCRM’s pages in a go_router host’s routes, where crmGoRoutes mounted them: a tapped push’s page goes there (open, after the frame, as a host’s own tapped notice would, since the tap may be served in the frame that takes the guest off the host’s last step), and a tap in the CRM pushes its page over the one it is on (push), so that Back comes back to it.
crmGoRoutesPurrCRM’s routes, to put among the host’s own: the messenger’s pages under /messages and the help center’s under /help, each PurrCRM’s screen for it.
class GoRouterCrmNavigator implements CrmNavigator

Shows PurrCRM’s pages in a go_router host’s routes, where crmGoRoutes mounted them: a tapped push’s page goes there (open, after the frame, as a host’s own tapped notice would, since the tap may be served in the frame that takes the guest off the host’s last step), and a tap in the CRM pushes its page over the one it is on (push), so that Back comes back to it.

GoRouterCrmNavigator(GoRouter router)
final GoRouter router
List<RouteBase> crmGoRoutes({required String fallback})

PurrCRM’s routes, to put among the host’s own: the messenger’s pages under /messages and the help center’s under /help, each PurrCRM’s screen for it.

fallback is the host’s own location (its help page, say) that a page whose feature the guest does not have (Crm.features) is sent to (each route’s redirect asks the facade of the CrmScope above the router), and that Back goes to from the messenger’s or the help center’s first screen when there is no page before it.

The redirect is asked whenever the router navigates or refreshes. A host whose router refreshes when its session changes (its refreshListenable) sends a page whose feature went off while it showed to fallback then, as long as it tells the facade the new session (Crm.session) before the router refreshes.

Mounted in a StatefulShellRoute’s branch, the pages are in that branch’s stack, and a page opened by a link stands over the ones above it in the link space (a conversation over the messenger), which Back goes back through.