restoreRouteInformation method
Restores the browser route information from the current configuration.
The URL path reflects the top-of-stack screen's screenName. Screens the
host's FeatureProvider recognizes round-trip fully (URL → navigation →
URL); screens pushed programmatically reflect in the address bar but, on
reload, resolve to no navigation unless the host also maps that screen
name to a FeatureRoute.
Restores the browser route information from the current configuration.
For single-stack controllers the URL path is /<topScreen>. For tabbed
controllers the active branch's screen name is prepended:
/<branchScreen>/<topScreen>.
Per-branch stack restoration is out of scope — only the active branch is encoded. Screens the host's FeatureProvider recognizes round-trip fully (URL → navigation → URL); screens pushed programmatically reflect in the address bar but, on reload, resolve to no navigation unless the host also maps that screen name to a FeatureRoute.
Implementation
@override
RouteInformation? restoreRouteInformation(Object configuration) {
if (configuration is! RouteConfig) return null;
final navigationType = configuration.navigationType;
if (navigationType is! ViewNavigationType) return null;
final screenName = navigationType.analyticsIdentifiable.screenName;
if (screenName.isEmpty) return null;
final branchScreenName = configuration.branchScreenName;
if (branchScreenName != null && branchScreenName.isNotEmpty) {
// Pass raw segment values: [Uri] percent-encodes each path segment
// itself, so pre-encoding with [Uri.encodeComponent] would double-escape
// (e.g. a space -> `%20` -> `%2520`).
return RouteInformation(
uri: Uri(pathSegments: <String>[branchScreenName, screenName]),
);
}
return RouteInformation(
uri: Uri(pathSegments: <String>[screenName]),
);
}