force portrait device orientation
Set a condition for runApp
:
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp])
.then((fn) {
runApp(const MyApp());
});
But before the above line, you should add:
Final code:WidgetsFlutterBinding.ensureInitialized();
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp])
.then((fn) {
runApp(const MyApp());
});