Be aware of your routes with RouteAware — Flutter!

There can be cases when you wish to perform certain actions on the change navigation history. This is where RouteAware comes to the rescue!

final RouteObserver<ModalRoute> routeObserver = RouteObserver<ModalRoute>();
@override
void initState() {
WidgetsBinding.instance!.addPostFrameCallback((timeStamp) {
routeObserver.subscribe(this, ModalRoute.of(context)!);
});
super.initState();
}

Don’t forget to connect with me!

Don’t stop, until you are breathing!💙
- Abhishek Doshi

Flutter Developer