Search code examples
fluttermaterialpageroute

Flutter laggy navigation


I have this auto platform detect navigation function but when I use it for the iPhone on release mode it lags but when I make it only with MaterialPageRoute it doesn't lag at all on iOS.

static navigateTo({BuildContext context, Widget w, bool fullscreenDialog}) {
    Platform.isIOS
    ? Navigator.push(context, CupertinoPageRoute(builder: (context) => w, fullscreenDialog: fullscreenDialog))
    : Navigator.push(context, MaterialPageRoute(builder: (context) => w, fullscreenDialog: fullscreenDialog));
}

Solution

  • Over time, it seems that this issue was being addressed on the latest versions of Flutter. Try to upgrade your Flutter:

     flutter upgrade
    

    If you will be running it on the latest iOS release, chances are you will also be getting the same issue. With that, here is a workaround that you can explore.