App/Flutter
[ FLUTTER ] 플랫폼 체크
HEON.D
2021. 10. 4. 00:14
https://stackoverflow.com/questions/45924474/how-do-you-detect-the-host-platform-from-dart-code
How do you detect the host platform from Dart code?
For UI that should differ slightly on iOS and Android, i.e. on different platforms, there must be a way to detect which one the app is running on, but I couldn't find it in the docs. What is it?
stackoverflow.com
import 'dart:io' show Platform;
if (Platform.isAndroid) {
// Android-specific code
} else if (Platform.isIOS) {
// iOS-specific code
}
Platform.isAndroid
Platform.isFuchsia
Platform.isIOS
Platform.isLinux
Platform.isMacOS
Platform.isWindows