Answers for "change orientation landscape on flutter"

3

flutter set orientation

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

void main() {
  // We need to call it manually,
  // because we going to call setPreferredOrientations()
  // before the runApp() call
  WidgetsFlutterBinding.ensureInitialized();
  
  // Than we setup preferred orientations,
  // and only after it finished we run our app
  SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp])
      .then((value) => runApp(MyApp()));
}
Posted by: Guest on March-25-2021

Code answers related to "change orientation landscape on flutter"

Browse Popular Code Answers by Language