| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of dart.io; | 5 part of dart.io; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Information about the environment in which the current program is running. | 8 * Information about the environment in which the current program is running. |
| 9 * | 9 * |
| 10 * Platform provides information such as the operating system, | 10 * Platform provides information such as the operating system, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 * [operatingSystem] getter. You can also use one of the static boolean | 46 * [operatingSystem] getter. You can also use one of the static boolean |
| 47 * getters: [isMacOS], [isLinux], and [isWindows]. | 47 * getters: [isMacOS], [isLinux], and [isWindows]. |
| 48 * | 48 * |
| 49 * import 'dart:io' show Platform, stdout; | 49 * import 'dart:io' show Platform, stdout; |
| 50 * | 50 * |
| 51 * void main() { | 51 * void main() { |
| 52 * // Get the operating system as a string. | 52 * // Get the operating system as a string. |
| 53 * String os = Platform.operatingSystem; | 53 * String os = Platform.operatingSystem; |
| 54 * // Or, use a predicate getter. | 54 * // Or, use a predicate getter. |
| 55 * if (Platform.isMacOS) { | 55 * if (Platform.isMacOS) { |
| 56 * Print('is a Mac'); | 56 * print('is a Mac'); |
| 57 * } else { | 57 * } else { |
| 58 * print('is not a Mac'); | 58 * print('is not a Mac'); |
| 59 * } | 59 * } |
| 60 * } | 60 * } |
| 61 * | 61 * |
| 62 * ## Other resources | 62 * ## Other resources |
| 63 * | 63 * |
| 64 * [Dart by Example](https://www.dartlang.org/dart-by-example/#dart-io-and-comma
nd-line-apps) | 64 * [Dart by Example](https://www.dartlang.org/dart-by-example/#dart-io-and-comma
nd-line-apps) |
| 65 * provides additional task-oriented code samples that show how to use | 65 * provides additional task-oriented code samples that show how to use |
| 66 * various API from the [dart:io] library. | 66 * various API from the [dart:io] library. |
| 67 */ | 67 */ |
| 68 class Platform { | 68 class Platform { |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 * | 172 * |
| 173 * If there is no --package-root flag, then the empty string is returned. | 173 * If there is no --package-root flag, then the empty string is returned. |
| 174 */ | 174 */ |
| 175 static String get packageRoot => _Platform.packageRoot; | 175 static String get packageRoot => _Platform.packageRoot; |
| 176 | 176 |
| 177 /** | 177 /** |
| 178 * Returns the version of the current Dart runtime. | 178 * Returns the version of the current Dart runtime. |
| 179 */ | 179 */ |
| 180 static String get version => _version; | 180 static String get version => _version; |
| 181 } | 181 } |
| OLD | NEW |