While not officially recommended, it's possible to use final ref = ProviderScope.containerOf(context)
to get a ProviderContainer
object, which can be used to read (but not watch) values from a Riverpod provider.
Alternatively, you can just use a Riverpod Provider to provide the whole GoRouter
object.