OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 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. |
| 4 |
| 5 import 'dart:io'; |
| 6 |
| 7 import 'package:path/path.dart' as p; |
| 8 import 'package:pub_semver/pub_semver.dart'; |
| 9 |
| 10 import 'io.dart'; |
| 11 |
| 12 /// Whether the Flutter SDK is available. |
| 13 final bool isAvailable = Platform.environment.containsKey("FLUTTER_ROOT"); |
| 14 |
| 15 /// The path to the root directory of the Flutter SDK. |
| 16 final String rootDirectory = Platform.environment["FLUTTER_ROOT"]; |
| 17 |
| 18 /// The Flutter SDK's version number, or `null` if the Flutter SDK is |
| 19 /// unavailable. |
| 20 final version = () { |
| 21 if (!isAvailable) return null; |
| 22 |
| 23 return new Version.parse( |
| 24 readTextFile(p.join(rootDirectory, "version")).trim()); |
| 25 }(); |
OLD | NEW |