setOrientationPortrait static method
Only works on Android and iOS
Implementation
static Future<bool> setOrientationPortrait() async {
if (isDesktop()) return Future.value(false);
// ios crash Supported orientations has no common orientation with the application
bool? changed = await _channel.invokeMethod("setOrientationPortrait");
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
DeviceOrientation.portraitDown,
]);
return Future.value(changed);
}