platform property

TargetPlatform get platform

Returns the current platform.

The returned platform value can be one of the following:

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;