With a MaterialApp
you can provide the navigatorKey
and use that in your middleware to redirect the user if necessary (as it's done in the flutter redux example).
But CupertinoApp
doesn’t have a navigatorKey
.
What we are doing now is to add the context
to the action so we have access to it in the middleware, and can then user Navigator.of(context)
, but this seems very wrong.
What is the best way to achieve this?
navigatorKey
has been added to the CupertinoApp
.