Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a down side to using GlobalKey<NavigatorState> to do all my route navigation?

Tags:

flutter

I have seen an example in flutter where you can navigate routes without having access to a BuildContext.

final GlobalKey<NavigatorState> _navKey = new GlobalKey<NavigatorState>();

navigatorKey.currentState.pushNamed('/');

Are there any drawbacks to doing all of my apps navigation with this method?

like image 473
Scorb Avatar asked Nov 07 '22 06:11

Scorb


1 Answers

No. There is no downside.

The performance concern is negligible in regards to screen switches.

like image 110
Scorb Avatar answered Dec 05 '22 19:12

Scorb