DartFlutter

go_router Upgrade 13 to 18: What Breaks at Each Major Version

Table of Contents

This post is for Flutter developers whose app still pins go_router 13 or 14 and who now have to move to 18, the version that requires Flutter 3.44 and the new material_ui package. A go_router upgrade across five majors looks like five changelog entries. However, the changelog does not tell you which of them fail the build and which ones compile cleanly and change behavior at runtime. So this post runs it. It takes two small apps, bumps go_router one major at a time on Flutter 3.50.1, and records the analyzer output and a probe test at every step. As a result, you get the real failure at each major, the raw output, and the exact fix.

The results in this post came from this environment:

Measured 2026-11-24
Windows 11 Pro 25H2 (build 26200), AMD Ryzen 5 8600G (6C/12T), 16 GB RAM
Flutter 3.50.1 stable (framework ae9b586f34, released 2026-11-20), Dart 3.14.0
go_router 13.2.5, 14.8.1, 15.1.3, 16.3.0, 17.5.0, 18.1.4 (newest of each major on pub.dev)
go_router_builder 2.4.1, 4.2.1 and 4.5.3; flutter_riverpod 3.5.0; material_ui 1.11.1
Flutter 3.35.2 (Dart 3.9.0), only to generate the go_router 13 era typed route file
Changelog: https://pub.dev/packages/go_router/changelog

Everything below is analyzer output and flutter test output. Neither varies between runs, so there is no spread to report. The chain ran twice: once with the go_router 13 code unchanged, where steps 14 to 18 each gave the identical single error, and once with that error fixed. Tests ran in debug mode, which matters for one result, as the go_router 15 section explains.

go_router Upgrade 13 to 18: The Short Answer

Only one of the five majors fails the build. The other four compile with zero errors and change what the app does at runtime. Here is what each step did to the test apps:

MajorChangelog headlineAnalyzer errorsWhat changed at runtimeFix
14.8.1onExit takes 2 parameters1Nothing elseAdd GoRouterState state
15.1.3URLs are case sensitive0/Cart fails an assertion, navigation is droppedFix the link, or skip to 16
16.3.0GoRouteData changes0Typed route .go() throws UnimplementedError; /Cart shows the error pageBuilder 4.2.1, add the mixin
17.5.0Shell routes notify root observers0Analytics observer sees every push inside a ShellRoutenotifyRootObserver: false
18.1.4Migrates to material_ui0Unmigrated app loses MaterialPage and gets no page transitionsMigrate the app to material_ui

In other words, a clean flutter analyze after a go_router upgrade proves almost nothing. Four of the five breaks only show up when code runs. The rest of this post shows each one, with the command and the raw output behind every row.

What Changed Between go_router 13 and 18

The go_router changelog is where any go_router upgrade starts. It marks five majors as breaking since 13.0.0 (published 2023-12-21). The relevant lines, quoted from it:

  • 14.0.0 (2024-04-24): “GoRouteData‘s onExit now takes 2 parameters BuildContext context, GoRouterState state.”
  • 15.0.0 (2025-02-26): “URLs are now case sensitive.” It also says it “Adds caseSensitive parameter to GoRouter“.
  • 16.0.0 (2025-07-01): “Bump major version for GoRouteData breaking changes”, including “GoRouteData now defines .location, .go(context), .push(context)…” and “Requires go_router_builder >= 3.0.0”.
  • 17.0.0 (2025-11-06): “ShellRoute‘s navigating changes notify GoRouter‘s observers by default.”
  • 18.0.0 (2026-08-10): “Migrates to material_ui and cupertino_ui” and “Updates minimum supported SDK version to Flutter 3.44/Dart 3.12.”

Two of those lines turned out to be slightly off. First, the onExit change also hits plain GoRoute(onExit: ...), not only GoRouteData, because both share the ExitCallback typedef. Second, in the code, caseSensitive lives on GoRoute, not GoRouter. A grep of 15.1.3 and 18.1.4 finds no such parameter on the router class. If you plan to switch case sensitivity off globally, there is no single switch.

For background on why go_router replaced raw Navigator 2.0 code in most apps, see the Navigator 2.0 vs GoRouter comparison.

The Test Setup: Two Apps and One Probe File

The test uses two samples in one Flutter project. Each touches a different part of the API, and a probe test prints what the router actually did instead of asserting. Consequently, the same test file runs unchanged on every major, and the output can be diffed.

Sample A: The Login Router From an Earlier Post

The first sample is the routing code from the site’s Riverpod login and register flow, which pins go_router: ^13.0.0. It uses a top-level redirect, state.matchedLocation and six plain GoRoute entries. One change was needed to compile it: that post tests authState is _Authenticated, a private freezed class that another file cannot reference, so a sealed AuthState class stands in for it. Riverpod was kept at 3.5.0 on every step, so only go_router moves.

Sample B: A Shop App That Touches Every Changed API

The second sample exists to hit each changelog entry. It has a ShellRoute with its own observer, a checkout route with onExit, a lower-case /cart route, and one typed route. Here is the router as it would have been written for go_router 13:

// lib/shop/shop_router.dart, go_router 13 version
import 'package:flutter/widgets.dart';
import 'package:go_router/go_router.dart';

import 'typed_routes.dart';

class ShopRouterConfig {
  final CountingObserver rootObserver = CountingObserver(); // e.g. analytics
  final CountingObserver shellObserver = CountingObserver();
  final ValueNotifier<bool> checkoutDirty = ValueNotifier<bool>(false);
  int onExitCalls = 0;

  late final GoRouter router = GoRouter(
    initialLocation: '/catalog',
    observers: <NavigatorObserver>[rootObserver],
    routes: <RouteBase>[
      ShellRoute(
        observers: <NavigatorObserver>[shellObserver],
        builder: (context, state, child) => ShopShell(child: child),
        routes: <RouteBase>[
          GoRoute(
            path: '/catalog',
            name: 'catalog',
            builder: (context, state) => const ShopPage('catalog'),
            routes: <RouteBase>[
              GoRoute(
                path: 'item/:id',
                name: 'item',
                builder: (context, state) =>
                    ShopPage('item:${state.pathParameters['id']}'),
              ),
            ],
          ),
          GoRoute(
            path: '/cart',
            name: 'cart',
            builder: (context, state) => const ShopPage('cart'),
          ),
        ],
      ),
      GoRoute(
        path: '/checkout',
        name: 'checkout',
        builder: (context, state) => const ShopPage('checkout'),
        // go_router 13 signature: one parameter.
        onExit: (BuildContext context) {
          onExitCalls++;
          return !checkoutDirty.value; // block leaving while the form is dirty
        },
      ),
      $orderRoute, // generated by go_router_builder
    ],
  );
}

CountingObserver records each didPush and didPop with the route name, which is exactly what an analytics observer does. The shop widgets import only package:flutter/widgets.dart. That way, the two test variants differ in one thing only: which library’s MaterialApp.router wraps the router.

The typed route uses the go_router_builder 2.x style from the go_router 13 era:

// lib/shop/typed_routes.dart, go_router 13 version
import 'package:flutter/widgets.dart';
import 'package:go_router/go_router.dart';

part 'typed_routes.g.dart';

@TypedGoRoute<OrderRoute>(path: '/orders/:orderId')
class OrderRoute extends GoRouteData {
  const OrderRoute({required this.orderId});

  final String orderId;

  @override
  Widget build(BuildContext context, GoRouterState state) =>
      Text('page:order:$orderId');
}

Why the Typed Route File Was Generated on Flutter 3.35

A real go_router 13 project carries its typed_routes.g.dart from when it was written. Reproducing that on Flutter 3.50.1 turned out to be impossible. With go_router_builder: ^2.4.0, pub picks 2.9.0, and that version crashes on the new SDK. Its analyzer (7.7.1) cannot read dot shorthand syntax:

W SDK language version 3.14.0 is newer than `analyzer` language version 3.9.0. Run `flutter packages upgrade`.
E go_router_builder on lib/login/app_router.dart:
  Exception: Missing implementation of visitDotShorthandPropertyAccess

After that exception, the process stopped printing and stayed alive. One attempt sat for ten minutes before it was killed. The same builder also fails on Flutter 3.35.2 against go_router 13, for a different reason. Builder 2.9.0 declares no go_router constraint, yet it expects a field that only exists from go_router 15.1.0:

E go_router_builder on lib/typed_routes.dart:
  FormatException: Class TypedGoRoute does not have field "caseSensitive".

So the file was generated with go_router_builder 2.4.1 (published 2024-01-04, the release current alongside go_router 13) on Flutter 3.35.2. It produces an extension, not a mixin:

// typed_routes.g.dart from go_router_builder 2.4.1 (abridged)
extension $OrderRouteExtension on OrderRoute {
  static OrderRoute _fromState(GoRouterState state) => OrderRoute(
        orderId: state.pathParameters['orderId']!,
      );

  String get location => GoRouteData.$location(
        '/orders/${Uri.encodeComponent(orderId)}',
      );

  void go(BuildContext context) => context.go(location);
  // push, pushReplacement and replace follow the same pattern
}

Keep that extension in mind. It is the reason go_router 16 fails silently.

Recording One Step

Each step runs the analyzer, the probe tests and a dart fix dry run, and saves the output. The probe file prints one PROBE line per observation, for example the visible page after router.go('/Cart') or the runtime class of the current ModalRoute:

#!/usr/bin/env bash
# Record one upgrade step. Usage: ./run-step.sh <label>   (run from the app root)
set -u
out="../out/$1"; mkdir -p "$out"
flutter analyze --no-fatal-infos --no-fatal-warnings > "$out/analyze.txt" 2>&1
flutter test --reporter expanded > "$out/test.txt" 2>&1
echo "flutter test exit: $?" >> "$out/test.txt"
grep '^PROBE' "$out/test.txt" > "$out/probes.txt"
dart fix --dry-run > "$out/fix.txt" 2>&1

The chain itself only rewrites the constraint and resolves again:

for v in 13 14 15 16 17 18; do
  sed -i -E "s/^  go_router: .*/  go_router: ^$v.0.0/" pubspec.yaml
  flutter pub get > ../pubget-$v.txt 2>&1
  ver=$(awk '$0=="  go_router:"{f=1} f&&/version:/{gsub(/"/,"",$2); print $2; f=0}' pubspec.lock)
  bash ../run-step.sh "$ver"
done

Note that ^15.0.0 resolves to 15.1.3, not 15.2.x. The changelog explains why: the 15.2.x releases were folded into 16.0.0 as breaking.

At go_router 13.2.5, the baseline is clean: zero errors, zero warnings, three tests passing. The analyzer does report three infos, all of them Flutter 3.50’s deprecation of package:flutter/material.dart, which have nothing to do with go_router.

go_router 14: The Only Change That Fails the Build

The first bump produces the only compile error in the whole upgrade. The one-parameter onExit no longer fits:

flutter analyze
  error - The argument type 'bool Function(BuildContext)' can't be assigned to the parameter type 'ExitCallback?'.  - lib\shop\shop_router.dart:75:17 - argument_type_not_assignable

This is the change to make. The new parameter is the state of the route being left, which is useful when one callback guards several routes:

// go_router 14+ signature: context and the state of the route being left.
onExit: (BuildContext context, GoRouterState state) {
  onExitCalls++;
  return !checkoutDirty.value;
},

Unfortunately, dart fix does not help here. The dry run at 14.8.1 proposed three fixes, and all three were Flutter’s deprecated_member_use rewrites of the Material import. Nothing touched onExit. Worse, applying those three would start the material_ui migration in the middle of a router upgrade. The Dart 3.13 breaking changes test showed how badly a blanket dart fix --apply goes on Flutter 3.50, so run targeted fixes only.

Importantly, this one error masked everything else. Until onExit compiled, every later step showed the same single error, and the test files failed to load. Once it was fixed, steps 14 to 18 all analyzed with zero errors and zero warnings. Behavior at 14.8.1 matched 13.2.5 exactly: the probe output diff was empty.

At 15.1.3, the analyzer is clean, and all three tests pass, because the probes record exceptions instead of failing on them. Yet the probes show navigation being dropped. In the shop app, router.go('/Cart') targets a route declared as /cart. In the login sample, a signed-in user goes to /Profile:

PROBE material go /Cart                   /catalog page:catalog err='package:go_router/src/match.dart': Failed assertion: line 245 pos 12: 'uriPathToCompare.startsWith(newMatchedLocationToCompare)': is not true.
PROBE material login: go /Profile         /home page:home err='package:go_router/src/match.dart': Failed assertion: line 245 pos 12: 'uriPathToCompare.startsWith(newMatchedLocationToCompare)': is not true.

On go_router 13 and 14, both links worked. They landed on page:cart and page:profile. On 15.1.3, the user stays where they were, and in debug mode an assertion fires. The changelog promised case-sensitive URLs, which would mean a “not found” page. Instead, you get neither the page nor the error screen.

The source explains the mismatch. In 15.1.3, path_utils.dart still builds every route regex with caseSensitive: false, so /Cart matches the /cart route. Then match.dart compares the two strings case-sensitively, finds they differ, and falls through to an assertion. The 16.0.0 changelog lists the repair: “(Previously 15.2.4) Fixes routing to treat URLs with different cases as distinct routes.”

One limitation applies. These tests run in debug mode, where assertions are on. In a release build the assertion is skipped, and the code after it slices the path at an offset that assumes a prefix match. This run did not measure what a release build does next, so treat 15.x as unsafe for mixed-case links rather than guessing the exact failure. In practice, if an app receives deep links from email, push notifications or marketing tools, capitalised paths do arrive. Therefore, either skip 15 entirely or fix your links before you land on it.

go_router 16: Typed Routes That Compile and Then Throw

Step 16.3.0 is the most dangerous point of the go_router upgrade. The analyzer reports zero errors with the go_router 13 era generated file still in place. However, the shop test fails at runtime:

The following UnimplementedError was thrown running a test:
Should be generated using [Type-safe
routing](https://pub.dev/documentation/go_router/latest/topics/Type-safe%20routes-topic.html).

When the exception was thrown, this was the stack:
#0      GoRouteData.go (package:go_router/src/route_data.dart:187:7)

Here is why it compiles. Since 16.0.0, GoRouteData declares location, go, push, pushReplacement and replace as real instance members, and each one throws:

// go_router 16.3.0, lib/src/route_data.dart (abridged)
String get location => throw _GoRouteDataBase.shouldBeGeneratedError;

void go(BuildContext context) =>
    throw _GoRouteDataBase.shouldBeGeneratedError;

Dart always prefers a class’s own member over an extension member with the same name. The old $OrderRouteExtension.go still exists, but const OrderRoute(orderId: '42').go(context) now resolves to the throwing method on GoRouteData. There is no warning, because shadowing an extension member is legal. In an app, the first tap on any typed-route button throws, which makes this break easy to ship if your tests never navigate through typed routes.

The same step also completes the case-sensitivity change. /Cart and /Profile now land on the error page:

PROBE material go /Cart                   /Cart (no page text) err=none
PROBE material error text                 Home | Page Not Found

Regenerating Typed Routes for go_router 16

The fix is to regenerate with a newer builder and add the generated mixin. Builder 3.0.0 made the mixin mandatory (with _$OrderRoute), and builder 4.0.0 made it public (with $OrderRoute). The newest builder tells you exactly what to add:

dart run build_runner build
E go_router_builder on lib/shop/typed_routes.dart:
  Missing mixin clause `with $OrderRoute`
  package:gr_probe/shop/typed_routes.dart:8:7
    ╷
  8 │ class OrderRoute extends GoRouteData {
    │       ^^^^^^^^^^
    ╵

After the mixin is added, the newest builder (4.5.3) generates code that does not compile against go_router 16:

  error - The named parameter 'hasOverriddenOnExit' isn't defined. Try correcting the name to an existing named parameter's name, or defining a named parameter with the name 'hasOverriddenOnExit' - lib\shop\typed_routes.g.dart:15:7 - undefined_named_parameter

That parameter arrived in go_router 17.3.0, and builder 4.4.0 started emitting it. Like 2.9.0, the builder declares no go_router constraint, so pub happily pairs them. Here is every builder tried against go_router 16.3.0 on Flutter 3.50.1:

go_router_builderResolved analyzerResult with go_router 16.3.0
4.5.314.7.0Generates, then 1 analyzer error (hasOverriddenOnExit)
4.3.113.3.0Build script fails: 'qualifiedName' is defined in multiple extensions
4.3.012.1.0Build script fails, same error
4.2.112.1.0Builds, 0 errors, all tests pass
4.1.39.0.0Builds, 0 errors
4.0.17.7.1Builder crashes on the SDK

So if you stop at 16, pin go_router_builder: 4.2.1. Otherwise go straight to 17.5 or later, where the latest builder works. With 4.2.1 and the mixin, step 16.3.0 analyzed clean, all three tests passed, and the only difference from 13 was the case-sensitivity change above.

The type-safe class after the fix:

// lib/shop/typed_routes.dart, go_router 16+ with go_router_builder 4.x
@TypedGoRoute<OrderRoute>(path: '/orders/:orderId')
class OrderRoute extends GoRouteData with $OrderRoute {
  const OrderRoute({required this.orderId});

  final String orderId;

  @override
  Widget build(BuildContext context, GoRouterState state) =>
      Text('page:order:$orderId');
}

The Lockfile Trap During Builder Bumps

One more result is worth knowing. Pinning builder 4.2.1 right after a failed attempt with 4.0.1 broke the build script (The method 'getInvocation' isn't defined for the type 'DartObjectImpl'). The reason: pub kept build_runner 2.7.1 locked from the earlier attempt. After deleting pubspec.lock and resolving again, the same pubspec resolved build_runner 2.15.1 and built cleanly. If a builder change fails with an error inside source_gen or analyzer, resolve from a clean lockfile before concluding the version is broken.

go_router 17: Root Observers Now See Shell Navigation

At 17.5.0, everything compiles and every test passes. Even so, the analytics count changes. In the shop app, the root observer is the one a typical analytics package registers. Pushing an item inside the shell and popping it back now reaches it. These are the matching lines from the two runs, prefixed with the go_router version:

13.2.5  PROBE material root observer (after pop)  push:null
17.5.0  PROBE material root observer (after pop)  push:null push:catalog push:item pop:item

The shell observer saw the same three events on both versions. In other words, from 17 on, every screen inside a ShellRoute is reported to both observers. For an app with bottom navigation built on ShellRoute or StatefulShellRoute, that means screen-view events change after the upgrade. Events either double, if you already logged them from the shell observer, or appear for the first time. Neither shows up in a test suite that does not count observer calls.

To restore the old behavior, set the new flag on the shell route:

ShellRoute(
  notifyRootObserver: false, // go_router 17+: keep shell navigation out of root observers
  observers: <NavigatorObserver>[shellObserver],
  builder: (context, state, child) => ShopShell(child: child),
  routes: <RouteBase>[/* ... */],
),

That said, the new default is arguably more correct for analytics. Decide which observer owns screen views, then set the flag to match, instead of accepting whichever default the version gives you.

go_router 18: Unmigrated Apps Lose Material Pages

Step 18.1.4 also compiles cleanly, and all tests pass. The probes, however, show a change that affects every screen in the app. The test runs the shop sample under two apps: one that still uses package:flutter/material.dart, as nearly every existing app does, and one migrated to material_ui. Here are the route class and error screen lines in each case, taken from the two runs and prefixed with the go_router version:

13.2.5  PROBE material route class                _PageBasedMaterialPageRoute<void>
13.2.5  PROBE material unknown route              err=none texts=Home | Page Not Found
13.2.5  PROBE material_ui route class                _CustomTransitionPageRoute<void>
18.1.4  PROBE material route class                _CustomTransitionPageRoute<void>
18.1.4  PROBE material unknown route              err=none texts=Page Not Found | GoException: no routes for location: /does-not-exist | Go to home page
18.1.4  PROBE material_ui route class                _PageBasedMaterialPageRoute<void>

The two apps swapped places. On 18, an app still built on the framework’s MaterialApp.router no longer gets a MaterialPage for routes that use builder:. Meanwhile, an app on material_ui now does.

App’s MaterialApp comes fromgo_router 13 to 17go_router 18
package:flutter/material.dartMaterialPage, Material error screenNoTransitionPage, plain error screen
package:material_ui/material_ui.dartNoTransitionPage, plain error screenMaterialPage, Material error screen

The cause is a single import. go_router detects the app type with context.findAncestorWidgetOfExactType<MaterialApp>(). In 18.1.4, lib/src/pages/material.dart imports MaterialApp from package:material_ui/material_ui.dart. The framework’s MaterialApp is a different class with the same name, so the lookup fails, and the builder falls through to its last branch:

// go_router 18.1.4, lib/src/builder.dart (abridged)
} else {
  log('Using WidgetsApp configuration');
  _pageBuilderForAppType = (...) => NoTransitionPage<void>(...);
  _errorBuilderForAppType = (BuildContext c, GoRouterState s) => ErrorScreen(s.error);
}

In practice, that means no page transition animation on any builder: route, the plain error screen, and, per the same file, a plain HeroController instead of the Material one. Reading the framework source, MaterialPage is also what gives iOS its swipe-back gesture through the Cupertino transition. NoTransitionPage has none, but this test did not run on a device to confirm it. Routes that use pageBuilder: with your own MaterialPage should not be affected, since the source shows go_router uses whatever page you return, though the probe did not include such a route.

To check an app quickly, turn on debugLogDiagnostics: true and look for Using WidgetsApp configuration in the log. A Material app on 18 should print Using MaterialApp configuration.

The real fix is to migrate the app’s MaterialApp to material_ui, which the material_ui migration guide covers along with its own traps. Until you do, wrap routes in pageBuilder: (context, state) => MaterialPage(child: ...) for the screens where transitions matter. Notably, go_router itself did not treat this as a compile-level break. The changelog line is “Migrates to material_ui and cupertino_ui”, without a word about apps that have not.

go_router Upgrade Opt-Outs That Restore 13 Behavior

Two of the runtime changes have switches. To confirm they work, both were added at 18.1.4, with caseSensitive: false on the /cart route and notifyRootObserver: false on the shell:

GoRoute(
  path: '/cart',
  caseSensitive: false, // go_router 15+: accept /Cart, /CART and /cart
  builder: (context, state) => const ShopPage('cart'),
),

The probe diff against the plain 18.1.4 run shows both changes reverting to the go_router 13 output:

< PROBE material root observer (after pop)  push:null push:catalog push:item pop:item
> PROBE material root observer (after pop)  push:null
< PROBE material go /Cart                   /Cart (no page text) err=none
> PROBE material go /Cart                   /Cart page:cart err=none

There is no global case-sensitivity switch in 18.1.4, so caseSensitive: false goes on each route that external links can reach. For apps with a deep linking setup, start with the routes listed in your associated domains and app links configuration.

How to Upgrade go_router From 13 to 18 Safely

Based on the run above, this order avoids every silent failure it found:

  1. Write one widget test that navigates through each typed route and each mixed-case link you know of. Without it, steps 15 and 16 pass CI.
  2. Bump to ^14.0.0 and change every onExit callback to take (BuildContext context, GoRouterState state).
  3. Skip 15 entirely, because its case handling fails an assertion instead of returning a result.
  4. Bump to ^17.0.0, upgrade go_router_builder to ^4.0.0, add with $RouteName to every typed route class, and regenerate.
  5. Add caseSensitive: false to routes that external links can reach with different casing.
  6. Decide which observer logs screen views, and set notifyRootObserver on shell routes to match.
  7. Migrate the app’s MaterialApp to material_ui before or together with ^18.0.0, then confirm the log prints Using MaterialApp configuration.

Make each step of the go_router upgrade its own commit. If something regresses, you can bisect by major instead of untangling five changes at once.

A Real Scenario: The Bottom-Nav App That Lost Its Transitions

Consider a small team maintaining a mid-sized shopping app with 20 to 30 screens, a bottom navigation bar on a ShellRoute, and a dozen typed routes. The upgrade lands as a dependency bump PR during a sprint that is mostly about something else. flutter analyze is clean after the onExit fix, the unit tests pass, and the PR merges.

The problems arrive in sequence after release. First, the product team notices screen-view counts jumping for every tab, because 17 now reports shell navigation to the root analytics observer. Next, QA finds that the order detail button throws, because the typed route extension is shadowed. Finally, design flags that pages no longer slide in, because the app never moved off package:flutter/material.dart. None of the three produced a compile error. Each one is a single-line fix once found. The expensive part is finding them in production instead of in the PR, which is what the probe-style test in this post is for.

When to Upgrade go_router One Major at a Time

  • Your app uses typed routes, onExit, or ShellRoute observers, since each lands in a different major
  • You need to know which major caused a regression, for example a changed analytics number
  • Your test suite does not navigate through every route, so the analyzer is your main signal
  • Several developers work on the router, and small PRs are easier to review

When NOT to Jump Straight to go_router 18

  • The app still uses the framework’s MaterialApp, and you are not ready for the material_ui migration
  • You depend on a package that declares go_router: <18.0.0, which blocks resolution anyway
  • Your Flutter version is below 3.44, the floor that 18.0.0 sets
  • You rely on go_router_builder output you have not regenerated since builder 2.x

Common Mistakes in a go_router Upgrade

  • Treating a clean flutter analyze as proof the upgrade worked, when four of five breaks are runtime only
  • Running dart fix --apply to clear the upgrade, which on Flutter 3.50 rewrites the Material imports instead
  • Leaving go_router_builder unconstrained, so pub picks a version written for a different go_router
  • Stopping at 15.x, where mixed-case links fail an assertion rather than resolving
  • Assuming caseSensitive can be turned off on GoRouter, when it only exists per GoRoute
  • Counting screen views from both the root and shell observers after 17, which doubles events
  • Debugging a broken builder before deleting pubspec.lock, when a stale locked build_runner is the cause

What This Test Does Not Cover

First, both samples are small. They hit each changelog entry once, but a large app has more patterns, such as StatefulShellRoute branches, redirect chains and custom pageBuilder transitions. Those were not exercised. Second, every result comes from flutter test in debug mode on Windows. Nothing ran on a phone or in a release build, so the release-mode behavior of the 15.x assertion and the iOS swipe-back effect of 18 are read from source, not measured.

Third, only the newest patch of each major was tested. A project locked to an early patch, such as 14.0.0, can behave differently from 14.8.1. Finally, Riverpod stayed at 3.5.0 throughout, instead of the 2.x that the login post pins, so that only go_router changed. As a version-pinned post, it will be re-checked every three months and on the next go_router major. The running list of SDK-level changes lives in the Flutter breaking changes tracker.

Conclusion

A go_router upgrade from 13 to 18 produced exactly one compile error, the onExit signature in 14. Everything else compiled cleanly and changed at runtime. Specifically, 15 drops mixed-case navigation with an assertion, 16 makes old typed routes throw UnimplementedError, 17 sends shell navigation to root observers, and 18 silently turns an unmigrated Material app into a no-transition app.

So write the navigation test first, then move one major at a time, skip 15, and pair go_router 16 with builder 4.2.1 or jump to 17. Make the material_ui move part of the 18 step, not an afterthought. To start, add debugLogDiagnostics: true, run your app once, and check which configuration line go_router prints. That single log line tells you whether your app is ready for go_router 18 today.