platform property
TargetPlatform
get
platform
Returns the current platform.
The returned platform value can be one of the following:
- TargetPlatform.android
- TargetPlatform.iOS
- TargetPlatform.macOS
- TargetPlatform.windows
- TargetPlatform.fuchsia
- TargetPlatform.linux
Example usage:
TargetPlatform currentPlatform = context.platform;
if (currentPlatform == TargetPlatform.iOS) {
print('Running on iOS');
} else if (currentPlatform == TargetPlatform.android) {
print('Running on Android');
}
Implementation
TargetPlatform get platform => Theme.of(this).platform;