Last active
June 28, 2019 03:28
-
-
Save chunhunghan/34b993428684e26468e19547106acae0 to your computer and use it in GitHub Desktop.
Flutter : Check current platform https://stackoverflow.com/questions/45924474/how-do-you-detect-the-host-platform-from-dart-code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'dart:io' show Platform; | |
| if (Platform.isAndroid) { | |
| // Android-specific code | |
| } else if (Platform.isIOS) { | |
| // iOS-specific code | |
| } | |
| /* | |
| Other options include: | |
| Platform.isFuchsia | |
| Platform.isLinux | |
| Platform.isMacOS | |
| Platform.isWindows | |
| */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment