Unverified Commit d99ab6aa authored by Erik Ernst's avatar Erik Ernst Committed by GitHub

Update utils.dart to work with the breaking change of SDK issue 40678 (#53093)

parent 151c8db7
...@@ -19,11 +19,25 @@ import 'framework.dart'; ...@@ -19,11 +19,25 @@ import 'framework.dart';
String cwd = Directory.current.path; String cwd = Directory.current.path;
/// The local engine to use for [flutter] and [evalFlutter], if any. /// The local engine to use for [flutter] and [evalFlutter], if any.
String get localEngine => const String.fromEnvironment('localEngine'); String get localEngine {
// Use two distinct `defaultValue`s to determine whether a 'localEngine'
// declaration exists in the environment.
const bool isDefined =
String.fromEnvironment('localEngine', defaultValue: 'a') ==
String.fromEnvironment('localEngine', defaultValue: 'b');
return isDefined ? const String.fromEnvironment('localEngine') : null;
}
/// The local engine source path to use if a local engine is used for [flutter] /// The local engine source path to use if a local engine is used for [flutter]
/// and [evalFlutter]. /// and [evalFlutter].
String get localEngineSrcPath => const String.fromEnvironment('localEngineSrcPath'); String get localEngineSrcPath {
// Use two distinct `defaultValue`s to determine whether a
// 'localEngineSrcPath' declaration exists in the environment.
const bool isDefined =
String.fromEnvironment('localEngineSrcPath', defaultValue: 'a') ==
String.fromEnvironment('localEngineSrcPath', defaultValue: 'b');
return isDefined ? const String.fromEnvironment('localEngineSrcPath') : null;
}
List<ProcessInfo> _runningProcesses = <ProcessInfo>[]; List<ProcessInfo> _runningProcesses = <ProcessInfo>[];
ProcessManager _processManager = const LocalProcessManager(); ProcessManager _processManager = const LocalProcessManager();
......
...@@ -33,4 +33,11 @@ void main() { ...@@ -33,4 +33,11 @@ void main() {
expect(parseServicePort(badOutput), null); expect(parseServicePort(badOutput), null);
}); });
}); });
group('engine environment declarations', () {
test('localEngine', () {
expect(localEngine, null);
expect(localEngineSrcPath, null);
});
});
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment