csells / go_router

The purpose of the go_router for Flutter is to use declarative routes to reduce complexity, regardless of the platform you're targeting (mobile, web, desktop), handling deep linking from Android, iOS and the web while still allowing an easy-to-use developer experience.
https://gorouter.dev
442 stars 96 forks source link

Question about GoRouter and NavigatorObserver #84

Closed s9th closed 2 years ago

s9th commented 2 years ago

I am looking at implementing go_router in my application as it looks like a perfect fit, except for one thing, which I might as well not fully understand.

I am using vanilla navigation right now and I have a use case to pause a video on a screen when the next route is pushed and resume playing video when next route is popped back. For this I am using RouteAware mixin in my widget and overriding didPushNext and didPopNext.

How would I go about implementing this with GoRouter? Auto_route package has AutoRouteAware, for instance.

csells commented 2 years ago

go_router has full support for NavigatorObserver objects, which you can pass in via the GoRouter constructor. @s9th can you give it a try and confirm that it works for your use case?

s9th commented 2 years ago

I will, thank you, but it will take time until I get to this task (hopefully later this week)

s9th commented 2 years ago

I can confirm that it works as intended. Thank you.