Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR DART

detect os in flutter

import 'dart:io' show Platform, stdout;

void main() {
  // Get the operating system as a string.
  String os = Platform.operatingSystem;
  // Or, use a predicate getter.
  if (Platform.isMacOS) {
    print('is a Mac');
  } else {
    print('is not a Mac');
  }
}
Source by api.flutter.dev #
 
PREVIOUS NEXT
Tagged: #detect #os #flutter
ADD COMMENT
Topic
Name
2+8 =