A App Config, Management, State - Flutter

By pjain      Published May 12, 2020, 5:10 a.m. in blog Programming   

Application Configuring

Set orientations

void main() async {
          /// Force the layout to Portrait mode
   WidgetsFlutterBinding.ensureInitialized(); // needed if run before runApp performed!
   await SystemChrome.setPreferredOrientations([
        DeviceOrientation.portraitUp,
        DeviceOrientation.portraitDown
  ]);
  runApp(new MyApp());
}

// in above - Do make it Landscape only --

    await SystemChrome.setPreferredOrientations([
        DeviceOrientation.landscapeLeft,
        DeviceOrientation.landscapeRight
      ]);

0 comments

There are no comments yet

Add new comment

Similar posts

List++ Advanced Application Features

Interview Questions in Flutter

NAV: URL Launcher, Deep Links

NAV: Navigation Drawers