If you want to force the application to Portrait mode in flutter? Put this code in the MyApp() and don’t forget to import the services package:
1 2 3 4 5 6 7 8 9 10 11 12 | import 'package:flutter/services.dart'; class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { SystemChrome.setPreferredOrientations([ DeviceOrientation.portraitUp, DeviceOrientation.portraitDown, ]); return new MaterialApp(); } } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.