Answers for "how to check operating system in dart"

0

how to check operating system in dart

import 'dart:io';

main(List<String> arguments) {
  print('OS: ${Platform.operatingSystem} ${Platform.version}');

  if(Platform.isLinux) {
    print('Run linux code');
  } else {
    print('run normal code');
  }

  print('Path: ${Platform.script.path}');
  print('dart: ${Platform.executable}');

  print('Env:');
  Platform.environment.keys.forEach((key) {
    print('${key} ${Platform.environment[key]}');
  });
}
Posted by: Guest on September-13-2021

Code answers related to "how to check operating system in dart"

Code answers related to "Dart"

Browse Popular Code Answers by Language