Skip to content

Breaking changes

Tom Gilder edited this page May 6, 2021 · 4 revisions

Migration from 0.7 to 0.8

Sorry for the large number of breaking changes in 0.8, this is to get the API in a stable state leading to a 1.0 release. There hopefully won't be any more now.

onUnknownRoute

The onUnknownRoute method signature has changed, and no longer provides a BuildContext object.

If you need a context, you can get it from the routeBuilder callback:

RoutemasterDelegate(routesBuilder: (BuildContext context) {
    // Context is available here
})

Old

onUnknownRoute: (String route, BuildContext context) {
    return MaterialPage(child: NotFoundPage());
}

New

onUnknownRoute: (String route) {
    return MaterialPage(child: NotFoundPage());
}

Migration from 0.6 to 0.7

RouteData path property

The path property on RouteData no longer returns the full path, including query string, to match Dart's Uri object. The full including query string is now available from the fullPath property.

Old

routeData.path == '/route?query=string'

New

routeData.path == '/route'
routeData.fullPath == '/route?query=string'

Guards

Builder now takes a builder property instead of child. This is to make sure the child doesn't get built when the guard fails.

Old

Guard(
    validate: (info, context) => canShowPage(),
    child: MaterialPage<void>(child: MyPage()),
)

New

Guard(
    validate: (info, context) => canShowPage(),
    builder: () => MaterialPage<void>(child: MyPage()),
)