Skip to content

Upgrading go_router 0.7 to 0.8

Breaking0.7.1 → 0.8.8Breaking5New4Changed1Fixed2Other7

BreakingUpgrade verdict

5 breaking changes.

  • The setting that controls debug output has a new name, and the router now logs more debugging information.
  • The `.builder` constructor on GoRouter is gone because it was not reasonable to implement.
  • The package's API has been reworked, so code written for older versions may need changes.
  • Routes are now defined in a fixed way instead of conditionally, which makes the API simpler and lets you redirect at the route level.
Top 3 of 5 that need code or config changes
Breaking5
Renames debugOutputFullPaths to debugLogDiagnostics and adds additional debugging logging.
debugOutputFullPathsdebugLogDiagnostics
Removes the .builder constructor from GoRouter.
GoRouterGoRouter.builder
Refactors the go_router API for simplicity and capability, breaking existing callers.
Moves from conditional routing to fixed routing, simplifying the API and enabling route-level redirection.
Replaces guard objects with redirect functions.

Generated by DepDelta from published Dart source. Not mixed with prose notes.

  • removed: class GoRouterGuard: abstract extends ChangeNotifier
  • removed: class GoRouterLoginGuard extends GoRouterGuard
  • removed: ctor GoRouter.builder({ required GoRouterWidgetBuilder builder, String initialLocation = …, UrlPathStrategy? urlPathStrategy, })
  • removed: ctor GoRouterGuard([this.listenable])
  • removed: ctor GoRouterLoginGuard( Listenable loginInfo, { required this.loginPath, this.homePath = …, this.fromParam = …, })
  • removed: field GoRouter.Page<dynamic>>: final
  • removed: field GoRouterGuard.listenable: final Listenable?
  • removed: field GoRouterLoginGuard.fromParam: final String
  • removed: field GoRouterLoginGuard.homePath: final String
  • removed: field GoRouterLoginGuard.loginPath: final String
  • removed: field GoRouterState.pageKey: final ValueKey<String>
  • removed: field GoRouterState.router: final GoRouter
  • removed: get GoRouter.routeInformationParser: GoRouteInformationParser
  • removed: get GoRouter.routerDelegate: GoRouterDelegate
  • removed: get GoRouterLoggedIn.loggedIn: bool
  • removed: method GoRouter.getLocPages( BuildContext context, String location, Iterable<GoRoute> routes, ): Map<String, Page<dynamic>>
  • removed: method GoRouterGuard.dispose(): void
  • removed: method GoRouterGuard.redirect(String location): String?
  • removed: method GoRouterLoginGuard.redirect(String location): String?
  • removed: mixin GoRouterLoggedIn
  • removed: static method GoRouter.locationFor(String path, Map<String, String> params): String
  • removed: typedef GoRouterRoutesBuilder = Iterable<GoRoute> Function( BuildContext context, String location, )
  • removed: typedef GoRouterWidgetBuilder = Widget Function( BuildContext context, String location, )
  • changed: class GoRouter → class GoRouter extends ChangeNotifier
  • changed: ctor GoRoute({ required this.path, required this.builder, this.routes, }) → ctor GoRoute({ required this.path, this.builder = …, this.routes = …, this.redirect = …, })
  • changed: ctor GoRouter({ required GoRouterRoutesBuilder routes, required GoRouterPageBuilder error, GoRouterGuard? guard, String initialLocation = …, UrlPathStrategy? urlPathStrategy = …, }) → ctor GoRouter({ required List<GoRoute> routes, required GoRouterPageBuilder error, GoRouterRedirect? redirect, Listenable? refreshListenable, String initialLocation = …, UrlPathStrategy? urlPathStrategy = …, bool debugLogDiagnostics = …, })
  • changed: ctor GoRouterState({ required this.router, required this.location, required this.subloc, this.path = …, this.params = …, String>{}, this.error, String fullpath = …, }) → ctor GoRouterState({ required this.location, required this.subloc, this.path, this.fullpath, this.params = …, String>{}, this.error, })
  • changed: field GoRoute.routes: final List<GoRoute>? → field GoRoute.routes: final List<GoRoute>
  • changed: field GoRouterState.path: final String → field GoRouterState.path: final String?
  • added: field GoRoute.redirect: final GoRouterRedirect
  • added: field GoRouter.routeInformationParser: final
  • added: field GoRouter.routerDelegate: late final GoRouterDelegate
  • added: field GoRouterState.fullpath: final String?
  • added: get GoRouterState.pageKey: ValueKey<String>
  • added: method GoRouter.refresh(): void
  • added: typedef GoRouterRedirect = String? Function(GoRouterState state)