Upgrading go_router 11 to 12
Breaking11.1.4 → 12.1.3Breaking2New2Fixed4Other1
BreakingUpgrade verdict
2 breaking changes.
In plain terms
- Code that creates a RouteConfiguration directly must be updated to the new constructor arguments.
- Any code that calls RouteMatch.match must now pass a matchedPath argument.
Must act 2 items need code or config changes
go_router publishes an official migration guide for version 12. It covers more than the release notes do.
Migrating to go_router 12 ↗Dart SDK requirement changed in 12.1.3: >=2.19.0 <4.0.0 → >=3.0.0 <4.0.0.
Flutter requirement changed in 12.1.3: >=3.7.0 → >=3.10.0.
What you must change
Breaking2
Updates the constructor signature of RouteConfiguration.
RouteConfigurationAdds a required matchedPath named parameter to RouteMatch.match.
RouteMatch.matchmatchedPathAPI changes
Generated by DepDelta from published Dart source. Not mixed with prose notes.
- removed:
field RouteConfiguration.redirectLimit: final int - removed:
field RouteConfiguration.routes: final List<RouteBase> - removed:
field RouteConfiguration.topRedirect: final GoRouterRedirect - changed:
ctor GoRouter({ required List<RouteBase> routes, GoExceptionHandler? onException, GoRouterPageBuilder? errorPageBuilder, GoRouterWidgetBuilder? errorBuilder, GoRouterRedirect? redirect, Listenable? refreshListenable, int redirectLimit = …, bool routerNeglect = …, String? initialLocation, this.overridePlatformDefaultLocation = …, Object? initialExtra, List<NavigatorObserver>? observers, bool debug… → ctor GoRouter({ required List<RouteBase> routes, Codec<Object?, Object?>? extraCodec, GoExceptionHandler? onException, GoRouterPageBuilder? errorPageBuilder, GoRouterWidgetBuilder? errorBuilder, GoRouterRedirect? redirect, Listenable? refreshListenable, int redirectLimit = …, bool routerNeglect = …, String? initialLocation, bool overridePlatformDefaultLocation = …, Object? initialExtra, List<Navi… - changed:
ctor RouteConfiguration({ required this.routes, required this.redirectLimit, required this.topRedirect, required this.navigatorKey, }) → ctor RouteConfiguration( this._routingConfig, { required this.navigatorKey, this.extraCodec, }) - changed:
static method RouteMatch.match({ required RouteBase route, required String remainingLocation, required String matchedLocation, required Map<String, String> pathParameters, }): RouteMatch? → static method RouteMatch.match({ required RouteBase route, required String matchedPath, required String remainingLocation, required String matchedLocation, required Map<String, String> pathParameters, }): RouteMatch? - added:
class RoutingConfig - added:
ctor GoRouter.routingConfig({ required ValueListenable<RoutingConfig> routingConfig, Codec<Object?, Object?>? extraCodec, GoExceptionHandler? onException, GoRouterPageBuilder? errorPageBuilder, GoRouterWidgetBuilder? errorBuilder, Listenable? refreshListenable, bool routerNeglect = …, String? initialLocation, this.overridePlatformDefaultLocation = …, Object? initialExtra, List<NavigatorObserver>?… - added:
ctor RoutingConfig({ required this.routes, this.redirect = …, this.redirectLimit = …, }) - added:
field RouteConfiguration.extraCodec: final Codec<Object?, Object?>? - added:
field RoutingConfig.redirect: final GoRouterRedirect - added:
field RoutingConfig.redirectLimit: final int - added:
field RoutingConfig.routes: final List<RouteBase> - added:
get RouteConfiguration.redirectLimit: int - added:
get RouteConfiguration.routes: List<RouteBase> - added:
get RouteConfiguration.topRedirect: GoRouterRedirect - added:
method RouteConfiguration.reparse(RouteMatchList matchList): RouteMatchList