Upgrading go_router 12 to 13
Breaking12.1.3 → 13.2.5Breaking2Platform1New3Changed1Fixed3Other2
BreakingUpgrade verdict
2 breaking changes and a platform requirement change.
In plain terms
- The shape of the RouteMatchList object is different, so code that reads or builds it may need updating.
- How routes are matched to URLs has changed, which can alter which route is selected.
- The package now requires a newer Flutter and Dart version to use.
Must act 3 items need code or config changes
go_router publishes an official migration guide for version 13. It covers more than the release notes do.
Migrating to go_router 13 ↗Dart SDK requirement changed in 13.2.1: >=3.0.0 <4.0.0 → >=3.2.0 <4.0.0.
Flutter requirement changed in 13.2.1: >=3.10.0 → >=3.16.0.
What you must change
Breaking2
RouteMatchList structure changed.
RouteMatchListMatching logic updated.
Platform1
Updates minimum supported SDK version to Flutter 3.16/Dart 3.2.
API changes
Generated by DepDelta from published Dart source. Not mixed with prose notes.
- removed:
class RouteMatchList - removed:
field RouteBuilder.HeroController>: final Map<GlobalKey<NavigatorState>, HeroController> - removed:
method GoRouteInformationProvider.didPushRoute(String route): Future<bool> - removed:
method RouteBuilder.Function( BuildContext context, GoRouterState state, ): Widget - removed:
method RouteBuilder.buildPage( BuildContext context, GoRouterState state, Widget child, ): Page<Object?> - removed:
method RouteBuilder.buildState(RouteMatchList matchList, RouteMatch match): GoRouterState - removed:
method RouteBuilder.pageBuilderForWidgetApp({ required LocalKey key, required String? name, required Object? arguments, required String restorationId, required Widget child, }): Page<void> - removed:
method RouteBuilder.tryBuild( BuildContext context, RouteMatchList matchList, bool routerNeglect, GlobalKey<NavigatorState> navigatorKey, Map<Page<Object?>, GoRouterState> registry, ): Widget - removed:
method RouteMatchList.toString(): String - removed:
static method RouteMatch.match({ required RouteBase route, required String matchedPath, required String remainingLocation, required String matchedLocation, required Map<String, String> pathParameters, }): RouteMatch? - changed:
class RouteMatch → class RouteMatch extends RouteMatchBase - changed:
ctor GoRouterState( this._configuration, { required this.uri, required this.matchedLocation, this.name, this.path, required this.fullPath, required this.pathParameters, this.extra, this.error, required this.pageKey, }) → ctor GoRouterState( this._configuration, { required this.uri, required this.matchedLocation, this.name, this.path, required this.fullPath, required this.pathParameters, this.extra, this.error, required this.pageKey, this.topRoute, }) - changed:
field RouteMatch.route: final RouteBase → field RouteMatch.route: final GoRoute - changed:
field RouteMatchList.matches: final List<RouteMatch> → field RouteMatchList.matches: final List<RouteMatchBase> - changed:
method RouteMatchList.remove(RouteMatch match): RouteMatchList → method RouteMatchList.remove(RouteMatchBase match): RouteMatchList - changed:
typedef PopPageWithRouteMatchCallback = bool Function( Route<dynamic> route, dynamic result, RouteMatch? match) → typedef PopPageWithRouteMatchCallback = bool Function( Route<dynamic> route, dynamic result, RouteMatchBase match) - added:
class RouteMatchBase: abstract with Diagnosticable - added:
class RouteMatchList with Diagnosticable - added:
class ShellRouteMatch extends RouteMatchBase - added:
ctor RouteMatchBase() - added:
ctor ShellRouteMatch({ required this.route, required this.matches, required this.matchedLocation, required this.pageKey, required this.navigatorKey, }) - added:
field GoRouterState.topRoute: final GoRoute? - added:
field ShellRouteMatch.matchedLocation: final String - added:
field ShellRouteMatch.matches: final List<RouteMatchBase> - added:
field ShellRouteMatch.navigatorKey: final GlobalKey<NavigatorState> - added:
field ShellRouteMatch.pageKey: final ValueKey<String> - added:
field ShellRouteMatch.route: final ShellRouteBase - added:
get RouteMatchBase.matchedLocation: String - added:
get RouteMatchBase.pageKey: ValueKey<String> - added:
get RouteMatchBase.route: RouteBase - added:
get RouteMatchList.lastOrNull: RouteMatch? - added:
get ShellRouteMatch.hashCode: int - added:
method ImperativeRouteMatch.buildState( RouteConfiguration configuration, RouteMatchList matches): GoRouterState - added:
method RouteMatch.buildState( RouteConfiguration configuration, RouteMatchList matches): GoRouterState - added:
method RouteMatchBase.buildState( RouteConfiguration configuration, RouteMatchList matches): GoRouterState - added:
method RouteMatchBase.debugFillProperties(DiagnosticPropertiesBuilder properties): void - added:
method RouteMatchList.copyWith({ List<RouteMatchBase>? matches, Uri? uri, Map<String, String>? pathParameters, }): RouteMatchList - added:
method RouteMatchList.debugFillProperties(DiagnosticPropertiesBuilder properties): void - added:
method RouteMatchList.visitRouteMatches(RouteMatchVisitor visitor): void - added:
method ShellRouteMatch.buildState( RouteConfiguration configuration, RouteMatchList matches): GoRouterState - added:
method ShellRouteMatch.copyWith({ required List<RouteMatchBase>? matches, }): ShellRouteMatch - added:
method ShellRouteMatch.operator ==(Object other): bool - added:
static field RouteMatchBase.List<RouteMatchBase>>: const Map<GlobalKey<NavigatorState>?, List<RouteMatchBase>> - added:
static method RouteMatchBase.match({ required RouteBase route, required Map<String, String> pathParameters, required GlobalKey<NavigatorState> rootNavigatorKey, required Uri uri, }): List<RouteMatchBase> - added:
typedef RouteMatchVisitor = bool Function(RouteMatchBase)