Interesting in development
safe_route: type-safe navigation for Flutter
We type the arguments and results of Flutter routes so that navigation errors are caught at compile time, not while the app is running.

The standard Navigator.pushNamed takes arguments as Object?, and the compiler does not check that a screen gets data of the right type. A mistake there only shows up while the app is running.
safe_route describes each route as a SafeRoute with an argument type and a result type, and SafeRouter registers them and plugs into MaterialApp through onGenerateRoute. An extension on NavigatorState provides typed counterparts of the standard methods: pushRoute instead of pushNamed, popRoute instead of pop, plus variants for replacing a screen, clearing the stack and state restoration. Nested routes are supported too.
The package suits teams that use named routes and want the compiler to check the data passed between screens. Navigation code becomes easier to read, and mistakes are found earlier.
Open on pub.dev

