Prevent device orientation changes for specific screens and force "portrait"?

Viewed 77

In my flutter application, i want to set portrait orientation for only selected screens.

Code:

SystemChrome.setPreferredOrientations([
        DeviceOrientation.portraitUp,
        DeviceOrientation.portraitDown,
      ]);

Above code works fine until i visit to screen where i have set the orientation in build method. But i come back from that screen, the whole app orientation locks to "portrait" mode.

0 Answers
Related