Skip to content

Instantly share code, notes, and snippets.

@Fanreza
Created October 4, 2022 02:39
Show Gist options
  • Save Fanreza/0b2adaedab222f56a2162b06b27c4b8a to your computer and use it in GitHub Desktop.
Save Fanreza/0b2adaedab222f56a2162b06b27c4b8a to your computer and use it in GitHub Desktop.
Disable Orientation Change in Flutter
import 'package:flutter/services.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp])
.then((_) {
runApp(const MyApp());
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment