restoreRouteInformation method
for use by the Router architecture as part of the RouteInformationParser
Implementation
@override
RouteInformation? restoreRouteInformation(RouteMatchList configuration) {
if (configuration.isEmpty) {
return null;
}
final String location;
if (GoRouter.optionURLReflectsImperativeAPIs &&
configuration.matches.last is ImperativeRouteMatch) {
location = (configuration.matches.last as ImperativeRouteMatch)
.matches
.uri
.toString();
} else {
location = configuration.uri.toString();
}
return RouteInformation(
// TODO(chunhtai): remove this ignore and migrate the code
// https://github.com/flutter/flutter/issues/124045.
// ignore: deprecated_member_use
location: location,
state: _routeMatchListCodec.encode(configuration),
);
}