Unverified Commit 919dcf53 authored by Alexandre Ardhuin's avatar Alexandre Ardhuin Committed by GitHub

enable lints prefer_spread_collections and prefer_inlined_adds (#35189)

parent 31cf49a9
...@@ -33,11 +33,11 @@ analyzer: ...@@ -33,11 +33,11 @@ analyzer:
# Please see https://github.com/flutter/flutter/pull/24528 for details. # Please see https://github.com/flutter/flutter/pull/24528 for details.
sdk_version_async_exported_from_core: ignore sdk_version_async_exported_from_core: ignore
exclude: exclude:
- 'bin/cache/**' - "bin/cache/**"
# the following two are relative to the stocks example and the flutter package respectively # the following two are relative to the stocks example and the flutter package respectively
# see https://github.com/dart-lang/sdk/issues/28463 # see https://github.com/dart-lang/sdk/issues/28463
- 'lib/i18n/stock_messages_*.dart' - "lib/i18n/stock_messages_*.dart"
- 'lib/src/http/**' - "lib/src/http/**"
linter: linter:
rules: rules:
...@@ -143,7 +143,7 @@ linter: ...@@ -143,7 +143,7 @@ linter:
# - prefer_if_elements_to_conditional_expressions # not yet tested # - prefer_if_elements_to_conditional_expressions # not yet tested
# - prefer_if_null_operators # not yet tested # - prefer_if_null_operators # not yet tested
- prefer_initializing_formals - prefer_initializing_formals
# - prefer_inlined_adds # not yet tested - prefer_inlined_adds
# - prefer_int_literals # not yet tested # - prefer_int_literals # not yet tested
# - prefer_interpolation_to_compose_strings # not yet tested # - prefer_interpolation_to_compose_strings # not yet tested
- prefer_is_empty - prefer_is_empty
...@@ -152,7 +152,7 @@ linter: ...@@ -152,7 +152,7 @@ linter:
# - prefer_mixin # https://github.com/dart-lang/language/issues/32 # - prefer_mixin # https://github.com/dart-lang/language/issues/32
# - prefer_null_aware_operators # disable until NNBD, see https://github.com/flutter/flutter/pull/32711#issuecomment-492930932 # - prefer_null_aware_operators # disable until NNBD, see https://github.com/flutter/flutter/pull/32711#issuecomment-492930932
- prefer_single_quotes - prefer_single_quotes
# - prefer_spread_collections # not yet tested - prefer_spread_collections
- prefer_typing_uninitialized_variables - prefer_typing_uninitialized_variables
- prefer_void_to_null - prefer_void_to_null
# - provide_deprecation_message # not yet tested # - provide_deprecation_message # not yet tested
......
...@@ -117,11 +117,12 @@ class AnimatedBezierState extends State<AnimatedBezier> ...@@ -117,11 +117,12 @@ class AnimatedBezierState extends State<AnimatedBezier>
AnimationController controller; AnimationController controller;
CurvedAnimation curve; CurvedAnimation curve;
bool isPlaying = false; bool isPlaying = false;
List<List<Point>> pointList = <List<Point>>[] List<List<Point>> pointList = <List<Point>>[
..add(<Point>[]) <Point>[],
..add(<Point>[]) <Point>[],
..add(<Point>[]) <Point>[],
..add(<Point>[]); <Point>[],
];
bool isReversed = false; bool isReversed = false;
List<PathDetail> _playForward() { List<PathDetail> _playForward() {
......
...@@ -286,13 +286,14 @@ class SampleChecker { ...@@ -286,13 +286,14 @@ class SampleChecker {
'--snapshot=$_snippetsSnapshotPath', '--snapshot=$_snippetsSnapshotPath',
'--snapshot-kind=app-jit', '--snapshot-kind=app-jit',
path.canonicalize(_snippetsExecutable), path.canonicalize(_snippetsExecutable),
]..addAll(args), ...args,
],
workingDirectory: workingDirectory, workingDirectory: workingDirectory,
); );
} else { } else {
return Process.runSync( return Process.runSync(
_dartExecutable, _dartExecutable,
<String>[path.canonicalize(_snippetsSnapshotPath)]..addAll(args), <String>[path.canonicalize(_snippetsSnapshotPath), ...args],
workingDirectory: workingDirectory, workingDirectory: workingDirectory,
); );
} }
...@@ -311,7 +312,8 @@ class SampleChecker { ...@@ -311,7 +312,8 @@ class SampleChecker {
final List<String> args = <String>[ final List<String> args = <String>[
'--output=${outputFile.absolute.path}', '--output=${outputFile.absolute.path}',
'--input=${inputFile.absolute.path}', '--input=${inputFile.absolute.path}',
]..addAll(snippet.args); ...snippet.args,
];
print('Generating snippet for ${snippet.start?.filename}:${snippet.start?.line}'); print('Generating snippet for ${snippet.start?.filename}:${snippet.start?.line}');
final ProcessResult process = _runSnippetsScript(args); final ProcessResult process = _runSnippetsScript(args);
if (process.exitCode != 0) { if (process.exitCode != 0) {
...@@ -854,9 +856,11 @@ class Section { ...@@ -854,9 +856,11 @@ class Section {
), ),
); );
} }
return Section(<Line>[Line(prefix)] return Section(<Line>[
..addAll(codeLines) Line(prefix),
..add(Line(postfix))); ...codeLines,
Line(postfix),
]);
} }
Line get start => code.firstWhere((Line line) => line.filename != null); Line get start => code.firstWhere((Line line) => line.filename != null);
final List<Line> code; final List<Line> code;
...@@ -868,8 +872,8 @@ class Section { ...@@ -868,8 +872,8 @@ class Section {
/// analyzed. /// analyzed.
class Snippet { class Snippet {
Snippet({this.start, List<String> input, List<String> args, this.serial}) { Snippet({this.start, List<String> input, List<String> args, this.serial}) {
this.input = <String>[]..addAll(input); this.input = input.toList();
this.args = <String>[]..addAll(args); this.args = args.toList();
} }
final Line start; final Line start;
final int serial; final int serial;
......
...@@ -260,7 +260,9 @@ Future<EvalResult> _evalCommand(String executable, List<String> arguments, { ...@@ -260,7 +260,9 @@ Future<EvalResult> _evalCommand(String executable, List<String> arguments, {
Future<void> _runFlutterAnalyze(String workingDirectory, { Future<void> _runFlutterAnalyze(String workingDirectory, {
List<String> options = const <String>[], List<String> options = const <String>[],
}) { }) {
return runCommand(flutter, <String>['analyze', '--dartdocs']..addAll(options), return runCommand(
flutter,
<String>['analyze', '--dartdocs', ...options],
workingDirectory: workingDirectory, workingDirectory: workingDirectory,
); );
} }
...@@ -456,7 +458,10 @@ List<T> _deepSearch<T>(Map<T, Set<T>> map, T start, [ Set<T> seen ]) { ...@@ -456,7 +458,10 @@ List<T> _deepSearch<T>(Map<T, Set<T>> map, T start, [ Set<T> seen ]) {
final List<T> result = _deepSearch<T>( final List<T> result = _deepSearch<T>(
map, map,
key, key,
(seen == null ? <T>{start} : Set<T>.from(seen))..add(key), <T>{
if (seen == null) start else ...seen,
key,
},
); );
if (result != null) { if (result != null) {
result.insert(0, start); result.insert(0, start);
......
...@@ -381,14 +381,14 @@ class ArchiveCreator { ...@@ -381,14 +381,14 @@ class ArchiveCreator {
Future<String> _runFlutter(List<String> args, {Directory workingDirectory}) { Future<String> _runFlutter(List<String> args, {Directory workingDirectory}) {
return _processRunner.runProcess( return _processRunner.runProcess(
<String>[_flutter]..addAll(args), <String>[_flutter, ...args],
workingDirectory: workingDirectory ?? flutterRoot, workingDirectory: workingDirectory ?? flutterRoot,
); );
} }
Future<String> _runGit(List<String> args, {Directory workingDirectory}) { Future<String> _runGit(List<String> args, {Directory workingDirectory}) {
return _processRunner.runProcess( return _processRunner.runProcess(
<String>['git']..addAll(args), <String>['git', ...args],
workingDirectory: workingDirectory ?? flutterRoot, workingDirectory: workingDirectory ?? flutterRoot,
); );
} }
...@@ -574,14 +574,14 @@ class ArchivePublisher { ...@@ -574,14 +574,14 @@ class ArchivePublisher {
}) async { }) async {
if (platform.isWindows) { if (platform.isWindows) {
return _processRunner.runProcess( return _processRunner.runProcess(
<String>['python', path.join(platform.environment['DEPOT_TOOLS'], 'gsutil.py'), '--']..addAll(args), <String>['python', path.join(platform.environment['DEPOT_TOOLS'], 'gsutil.py'), '--', ...args],
workingDirectory: workingDirectory, workingDirectory: workingDirectory,
failOk: failOk, failOk: failOk,
); );
} }
return _processRunner.runProcess( return _processRunner.runProcess(
<String>['gsutil.py', '--']..addAll(args), <String>['gsutil.py', '--', ...args],
workingDirectory: workingDirectory, workingDirectory: workingDirectory,
failOk: failOk, failOk: failOk,
); );
......
...@@ -3,7 +3,7 @@ description: Scripts which run on bots. ...@@ -3,7 +3,7 @@ description: Scripts which run on bots.
environment: environment:
# The pub client defaults to an <2.0.0 sdk constraint which we need to explicitly overwrite. # The pub client defaults to an <2.0.0 sdk constraint which we need to explicitly overwrite.
sdk: ">=2.2.0 <3.0.0" sdk: ">=2.2.2 <3.0.0"
dependencies: dependencies:
path: 1.6.2 path: 1.6.2
......
...@@ -220,7 +220,7 @@ Future<void> _runToolCoverage() async { ...@@ -220,7 +220,7 @@ Future<void> _runToolCoverage() async {
final List<String> testGroup = tests[i]; final List<String> testGroup = tests[i];
await runCommand( await runCommand(
dart, dart,
<String>[path.join('tool', 'tool_coverage.dart'), '--']..addAll(testGroup), <String>[path.join('tool', 'tool_coverage.dart'), '--', ...testGroup],
workingDirectory: toolRoot, workingDirectory: toolRoot,
environment: <String, String>{ environment: <String, String>{
'FLUTTER_ROOT': flutterRoot, 'FLUTTER_ROOT': flutterRoot,
...@@ -791,7 +791,7 @@ Future<void> _runFlutterTest(String workingDirectory, { ...@@ -791,7 +791,7 @@ Future<void> _runFlutterTest(String workingDirectory, {
Map<String, String> environment, Map<String, String> environment,
List<String> tests = const <String>[], List<String> tests = const <String>[],
}) async { }) async {
final List<String> args = <String>['test']..addAll(options); final List<String> args = <String>['test', ...options];
if (flutterTestArgs != null && flutterTestArgs.isNotEmpty) if (flutterTestArgs != null && flutterTestArgs.isNotEmpty)
args.addAll(flutterTestArgs); args.addAll(flutterTestArgs);
......
...@@ -35,8 +35,7 @@ class FakeProcessManager extends Mock implements ProcessManager { ...@@ -35,8 +35,7 @@ class FakeProcessManager extends Mock implements ProcessManager {
set fakeResults(Map<String, List<ProcessResult>> value) { set fakeResults(Map<String, List<ProcessResult>> value) {
_fakeResults = <String, List<ProcessResult>>{}; _fakeResults = <String, List<ProcessResult>>{};
for (String key in value.keys) { for (String key in value.keys) {
_fakeResults[key] = <ProcessResult>[] _fakeResults[key] = (value[key] ?? <ProcessResult>[ProcessResult(0, 0, '', '')]).toList();
..addAll(value[key] ?? <ProcessResult>[ProcessResult(0, 0, '', '')]);
} }
} }
......
...@@ -334,7 +334,7 @@ class ArchiveUnpublisher { ...@@ -334,7 +334,7 @@ class ArchiveUnpublisher {
bool failOk = false, bool failOk = false,
bool confirm = false, bool confirm = false,
}) async { }) async {
final List<String> command = <String>['gsutil', '--']..addAll(args); final List<String> command = <String>['gsutil', '--', ...args];
if (confirm) { if (confirm) {
return _processRunner.runProcess( return _processRunner.runProcess(
command, command,
...@@ -358,7 +358,7 @@ class ArchiveUnpublisher { ...@@ -358,7 +358,7 @@ class ArchiveUnpublisher {
print(' $file'); print(' $file');
} }
} }
await _runGsUtil(<String>['rm']..addAll(files), failOk: true, confirm: confirmed); await _runGsUtil(<String>['rm', ...files], failOk: true, confirm: confirmed);
} }
Future<String> _cloudReplaceDest(String src, String dest) async { Future<String> _cloudReplaceDest(String src, String dest) async {
......
...@@ -17,7 +17,7 @@ Future<String> runFlutterAndQuit(List<String> args, Device device) async { ...@@ -17,7 +17,7 @@ Future<String> runFlutterAndQuit(List<String> args, Device device) async {
print('run: starting...'); print('run: starting...');
final Process run = await startProcess( final Process run = await startProcess(
path.join(flutterDirectory.path, 'bin', 'flutter'), path.join(flutterDirectory.path, 'bin', 'flutter'),
<String>['run', '--suppress-analytics']..addAll(args), <String>['run', '--suppress-analytics', ...args],
isBot: false, // we just want to test the output, not have any debugging info isBot: false, // we just want to test the output, not have any debugging info
); );
final List<String> stdout = <String>[]; final List<String> stdout = <String>[];
...@@ -61,8 +61,13 @@ void main() { ...@@ -61,8 +61,13 @@ void main() {
Future<void> checkMode(String mode, {bool releaseExpected = false, bool dynamic = false}) async { Future<void> checkMode(String mode, {bool releaseExpected = false, bool dynamic = false}) async {
await inDirectory(appDir, () async { await inDirectory(appDir, () async {
print('run: starting $mode test...'); print('run: starting $mode test...');
final List<String> args = <String>['--$mode']..addAll(dynamic ? <String>['--dynamic'] : const <String>[]); final List<String> args = <String>[
args.addAll(<String>['-d', device.deviceId, 'lib/build_mode.dart']); '--$mode',
if (dynamic) '--dynamic',
'-d',
device.deviceId,
'lib/build_mode.dart',
];
final String stdout = await runFlutterAndQuit(args, device); final String stdout = await runFlutterAndQuit(args, device);
if (!stdout.contains('>>> Release: $releaseExpected <<<')) { if (!stdout.contains('>>> Release: $releaseExpected <<<')) {
throw "flutter run --$mode ${dynamic ? '--dynamic ' : ''}didn't set kReleaseMode properly"; throw "flutter run --$mode ${dynamic ? '--dynamic ' : ''}didn't set kReleaseMode properly";
......
...@@ -40,7 +40,7 @@ Future<TaskResult> createFlutterRunTask() async { ...@@ -40,7 +40,7 @@ Future<TaskResult> createFlutterRunTask() async {
await inDirectory<void>(flutterGalleryDir, () async { await inDirectory<void>(flutterGalleryDir, () async {
startProcess( startProcess(
path.join(flutterDirectory.path, 'bin', 'flutter'), path.join(flutterDirectory.path, 'bin', 'flutter'),
<String>['run']..addAll(options), <String>['run', ...options],
environment: null, environment: null,
); );
final Completer<void> finished = Completer<void>(); final Completer<void> finished = Completer<void>();
......
...@@ -29,8 +29,9 @@ Future<void> main() async { ...@@ -29,8 +29,9 @@ Future<void> main() async {
deviceId, deviceId,
]; ];
final Process process = await startProcess( final Process process = await startProcess(
path.join(flutterDirectory.path, 'bin', 'flutter'), path.join(flutterDirectory.path, 'bin', 'flutter'),
<String>['run']..addAll(options)); <String>['run', ...options],
);
final Stream<String> lines = process.stdout final Stream<String> lines = process.stdout
.transform(utf8.decoder) .transform(utf8.decoder)
......
...@@ -262,17 +262,17 @@ class AndroidDevice implements Device { ...@@ -262,17 +262,17 @@ class AndroidDevice implements Device {
/// Executes [command] on `adb shell` and returns its exit code. /// Executes [command] on `adb shell` and returns its exit code.
Future<void> shellExec(String command, List<String> arguments, { Map<String, String> environment }) async { Future<void> shellExec(String command, List<String> arguments, { Map<String, String> environment }) async {
await adb(<String>['shell', command]..addAll(arguments), environment: environment); await adb(<String>['shell', command, ...arguments], environment: environment);
} }
/// Executes [command] on `adb shell` and returns its standard output as a [String]. /// Executes [command] on `adb shell` and returns its standard output as a [String].
Future<String> shellEval(String command, List<String> arguments, { Map<String, String> environment }) { Future<String> shellEval(String command, List<String> arguments, { Map<String, String> environment }) {
return adb(<String>['shell', command]..addAll(arguments), environment: environment); return adb(<String>['shell', command, ...arguments], environment: environment);
} }
/// Runs `adb` with the given [arguments], selecting this device. /// Runs `adb` with the given [arguments], selecting this device.
Future<String> adb(List<String> arguments, { Map<String, String> environment }) { Future<String> adb(List<String> arguments, { Map<String, String> environment }) {
return eval(adbPath, <String>['-s', deviceId]..addAll(arguments), environment: environment, canFail: false); return eval(adbPath, <String>['-s', deviceId, ...arguments], environment: environment, canFail: false);
} }
@override @override
......
...@@ -194,7 +194,7 @@ android { ...@@ -194,7 +194,7 @@ android {
Future<ProcessResult> resultOfFlutterCommand(String command, List<String> options) { Future<ProcessResult> resultOfFlutterCommand(String command, List<String> options) {
return Process.run( return Process.run(
path.join(flutterDirectory.path, 'bin', 'flutter'), path.join(flutterDirectory.path, 'bin', 'flutter'),
<String>[command]..addAll(options), <String>[command, ...options],
workingDirectory: rootPath, workingDirectory: rootPath,
); );
} }
......
...@@ -235,7 +235,7 @@ Future<Process> startProcess( ...@@ -235,7 +235,7 @@ Future<Process> startProcess(
environment ??= <String, String>{}; environment ??= <String, String>{};
environment['BOT'] = isBot ? 'true' : 'false'; environment['BOT'] = isBot ? 'true' : 'false';
final Process process = await _processManager.start( final Process process = await _processManager.start(
<String>[executable]..addAll(arguments), <String>[executable, ...arguments],
environment: environment, environment: environment,
workingDirectory: workingDirectory ?? cwd, workingDirectory: workingDirectory ?? cwd,
); );
......
...@@ -39,7 +39,7 @@ TaskFunction createHotModeTest() { ...@@ -39,7 +39,7 @@ TaskFunction createHotModeTest() {
{ {
final Process process = await startProcess( final Process process = await startProcess(
path.join(flutterDirectory.path, 'bin', 'flutter'), path.join(flutterDirectory.path, 'bin', 'flutter'),
<String>['run']..addAll(options), <String>['run', ...options],
environment: null, environment: null,
); );
...@@ -93,7 +93,7 @@ TaskFunction createHotModeTest() { ...@@ -93,7 +93,7 @@ TaskFunction createHotModeTest() {
{ {
final Process process = await startProcess( final Process process = await startProcess(
path.join(flutterDirectory.path, 'bin', 'flutter'), path.join(flutterDirectory.path, 'bin', 'flutter'),
<String>['run']..addAll(options), <String>['run', ...options],
environment: null, environment: null,
); );
final Completer<void> stdoutDone = Completer<void>(); final Completer<void> stdoutDone = Completer<void>();
......
...@@ -65,7 +65,7 @@ Future<Process> _startFlutter({ ...@@ -65,7 +65,7 @@ Future<Process> _startFlutter({
bool canFail = false, bool canFail = false,
Map<String, String> environment, Map<String, String> environment,
}) { }) {
final List<String> args = <String>['run']..addAll(options); final List<String> args = <String>['run', ...options];
return startProcess(path.join(flutterDirectory.path, 'bin', 'flutter'), args, environment: environment); return startProcess(path.join(flutterDirectory.path, 'bin', 'flutter'), args, environment: environment);
} }
......
...@@ -65,7 +65,7 @@ class FlutterProject { ...@@ -65,7 +65,7 @@ class FlutterProject {
await inDirectory(directory, () async { await inDirectory(directory, () async {
await flutter( await flutter(
'create', 'create',
options: <String>['--template=app', '--org', 'io.flutter.devicelab']..addAll(options)..add('plugintest'), options: <String>['--template=app', '--org', 'io.flutter.devicelab', ...options, 'plugintest'],
); );
}); });
return FlutterProject(directory, 'plugintest'); return FlutterProject(directory, 'plugintest');
......
...@@ -24,7 +24,7 @@ TaskFunction createRunWithoutLeakTest(dynamic dir) { ...@@ -24,7 +24,7 @@ TaskFunction createRunWithoutLeakTest(dynamic dir) {
await inDirectory<void>(dir, () async { await inDirectory<void>(dir, () async {
final Process process = await startProcess( final Process process = await startProcess(
path.join(flutterDirectory.path, 'bin', 'flutter'), path.join(flutterDirectory.path, 'bin', 'flutter'),
<String>['run']..addAll(options), <String>['run', ...options],
environment: null, environment: null,
); );
final Completer<void> stdoutDone = Completer<void>(); final Completer<void> stdoutDone = Completer<void>();
......
...@@ -37,7 +37,7 @@ TaskFunction createWebDevModeTest() { ...@@ -37,7 +37,7 @@ TaskFunction createWebDevModeTest() {
await packagesGet.exitCode; await packagesGet.exitCode;
final Process process = await startProcess( final Process process = await startProcess(
path.join(flutterDirectory.path, 'bin', 'flutter'), path.join(flutterDirectory.path, 'bin', 'flutter'),
<String>['run']..addAll(options), <String>['run', ...options],
environment: <String, String>{ environment: <String, String>{
'FLUTTER_WEB': 'true', 'FLUTTER_WEB': 'true',
}, },
...@@ -96,7 +96,7 @@ TaskFunction createWebDevModeTest() { ...@@ -96,7 +96,7 @@ TaskFunction createWebDevModeTest() {
{ {
final Process process = await startProcess( final Process process = await startProcess(
path.join(flutterDirectory.path, 'bin', 'flutter'), path.join(flutterDirectory.path, 'bin', 'flutter'),
<String>['run']..addAll(options), <String>['run', ...options],
environment: <String, String>{ environment: <String, String>{
'FLUTTER_WEB': 'true', 'FLUTTER_WEB': 'true',
}, },
......
...@@ -21,7 +21,7 @@ void main() { ...@@ -21,7 +21,7 @@ void main() {
} }
final String dart = path.absolute(path.join('..', '..', 'bin', 'cache', 'dart-sdk', 'bin', 'dart')); final String dart = path.absolute(path.join('..', '..', 'bin', 'cache', 'dart-sdk', 'bin', 'dart'));
final ProcessResult scriptProcess = processManager.runSync( final ProcessResult scriptProcess = processManager.runSync(
<String>[dart]..addAll(options) <String>[dart, ...options]
); );
return scriptProcess; return scriptProcess;
} }
......
...@@ -175,7 +175,8 @@ class SnippetGenerator { ...@@ -175,7 +175,8 @@ class SnippetGenerator {
} }
return <_ComponentTuple>[ return <_ComponentTuple>[
_ComponentTuple('description', description), _ComponentTuple('description', description),
]..addAll(components); ...components,
];
} }
String _loadFileAsUtf8(File file) { String _loadFileAsUtf8(File file) {
......
...@@ -6,7 +6,7 @@ homepage: https://github.com/flutter/flutter ...@@ -6,7 +6,7 @@ homepage: https://github.com/flutter/flutter
environment: environment:
# The pub client defaults to an <2.0.0 sdk constraint which we need to explicitly overwrite. # The pub client defaults to an <2.0.0 sdk constraint which we need to explicitly overwrite.
sdk: ">=2.0.0-dev.68.0 <3.0.0" sdk: ">=2.2.2 <3.0.0"
dartdoc: dartdoc:
# Exclude this package from the hosted API docs (Ironically...). # Exclude this package from the hosted API docs (Ironically...).
......
...@@ -117,7 +117,7 @@ Future<void> main(List<String> arguments) async { ...@@ -117,7 +117,7 @@ Future<void> main(List<String> arguments) async {
// Verify which version of dartdoc we're using. // Verify which version of dartdoc we're using.
final ProcessResult result = Process.runSync( final ProcessResult result = Process.runSync(
pubExecutable, pubExecutable,
<String>[]..addAll(dartdocBaseArgs)..add('--version'), <String>[...dartdocBaseArgs, '--version'],
workingDirectory: kDocsRoot, workingDirectory: kDocsRoot,
environment: pubEnvironment, environment: pubEnvironment,
); );
...@@ -137,7 +137,8 @@ Future<void> main(List<String> arguments) async { ...@@ -137,7 +137,8 @@ Future<void> main(List<String> arguments) async {
// Generate the documentation. // Generate the documentation.
// We don't need to exclude flutter_tools in this list because it's not in the // We don't need to exclude flutter_tools in this list because it's not in the
// recursive dependencies of the package defined at dev/docs/pubspec.yaml // recursive dependencies of the package defined at dev/docs/pubspec.yaml
final List<String> dartdocArgs = <String>[]..addAll(dartdocBaseArgs)..addAll(<String>[ final List<String> dartdocArgs = <String>[
...dartdocBaseArgs,
'--inject-html', '--inject-html',
'--header', 'styles.html', '--header', 'styles.html',
'--header', 'analytics.html', '--header', 'analytics.html',
...@@ -145,7 +146,8 @@ Future<void> main(List<String> arguments) async { ...@@ -145,7 +146,8 @@ Future<void> main(List<String> arguments) async {
'--header', 'snippets.html', '--header', 'snippets.html',
'--header', 'opensearch.html', '--header', 'opensearch.html',
'--footer-text', 'lib/footer.html', '--footer-text', 'lib/footer.html',
'--allow-warnings-in-packages', <String>[ '--allow-warnings-in-packages',
<String>[
'Flutter', 'Flutter',
'flutter', 'flutter',
'platform_integration', 'platform_integration',
...@@ -198,7 +200,7 @@ Future<void> main(List<String> arguments) async { ...@@ -198,7 +200,7 @@ Future<void> main(List<String> arguments) async {
'--favicon=favicon.ico', '--favicon=favicon.ico',
'--package-order', 'flutter,Dart,platform_integration,flutter_test,flutter_driver', '--package-order', 'flutter,Dart,platform_integration,flutter_test,flutter_driver',
'--auto-include-dependencies', '--auto-include-dependencies',
]); ];
String quote(String arg) => arg.contains(' ') ? "'$arg'" : arg; String quote(String arg) => arg.contains(' ') ? "'$arg'" : arg;
print('Executing: (cd $kDocsRoot ; $pubExecutable ${dartdocArgs.map<String>(quote).join(' ')})'); print('Executing: (cd $kDocsRoot ; $pubExecutable ${dartdocArgs.map<String>(quote).join(' ')})');
......
...@@ -3,7 +3,7 @@ description: Various repository development tools for flutter. ...@@ -3,7 +3,7 @@ description: Various repository development tools for flutter.
environment: environment:
# The pub client defaults to an <2.0.0 sdk constraint which we need to explicitly overwrite. # The pub client defaults to an <2.0.0 sdk constraint which we need to explicitly overwrite.
sdk: ">=2.2.0 <3.0.0" sdk: ">=2.2.2 <3.0.0"
dependencies: dependencies:
archive: 2.0.10 archive: 2.0.10
......
...@@ -434,7 +434,8 @@ class CupertinoDemoTab2 extends StatelessWidget { ...@@ -434,7 +434,8 @@ class CupertinoDemoTab2 extends StatelessWidget {
child: ListView( child: ListView(
children: <Widget>[ children: <Widget>[
Tab2Header(), Tab2Header(),
]..addAll(buildTab2Conversation()), ...buildTab2Conversation(),
],
), ),
), ),
); );
......
...@@ -493,11 +493,9 @@ class RecipeSheet extends StatelessWidget { ...@@ -493,11 +493,9 @@ class RecipeSheet extends StatelessWidget {
), ),
] ]
), ),
]..addAll(recipe.ingredients.map<TableRow>( ...recipe.ingredients.map<TableRow>((RecipeIngredient ingredient) {
(RecipeIngredient ingredient) {
return _buildItemRow(ingredient.amount, ingredient.description); return _buildItemRow(ingredient.amount, ingredient.description);
} }),
))..add(
TableRow( TableRow(
children: <Widget>[ children: <Widget>[
const SizedBox(), const SizedBox(),
...@@ -506,12 +504,11 @@ class RecipeSheet extends StatelessWidget { ...@@ -506,12 +504,11 @@ class RecipeSheet extends StatelessWidget {
child: Text('Steps', style: headingStyle), child: Text('Steps', style: headingStyle),
), ),
] ]
) ),
)..addAll(recipe.steps.map<TableRow>( ...recipe.steps.map<TableRow>((RecipeStep step) {
(RecipeStep step) {
return _buildItemRow(step.duration ?? '', step.description); return _buildItemRow(step.duration ?? '', step.description);
} }),
)), ],
), ),
), ),
), ),
......
...@@ -455,18 +455,14 @@ class GalleryOptionsPage extends StatelessWidget { ...@@ -455,18 +455,14 @@ class GalleryOptionsPage extends StatelessWidget {
const Divider(), const Divider(),
const _Heading('Platform mechanics'), const _Heading('Platform mechanics'),
_PlatformItem(options, onOptionsChanged), _PlatformItem(options, onOptionsChanged),
]..addAll( ..._enabledDiagnosticItems(),
_enabledDiagnosticItems(), const Divider(),
)..addAll( const _Heading('Flutter gallery'),
<Widget>[ _ActionItem('About Flutter Gallery', () {
const Divider(), showGalleryAboutDialog(context);
const _Heading('Flutter gallery'), }),
_ActionItem('About Flutter Gallery', () { _ActionItem('Send feedback', onSendFeedback),
showGalleryAboutDialog(context); ],
}),
_ActionItem('Send feedback', onSendFeedback),
],
),
), ),
); );
} }
......
...@@ -2,7 +2,7 @@ name: flutter_gallery ...@@ -2,7 +2,7 @@ name: flutter_gallery
environment: environment:
# The pub client defaults to an <2.0.0 sdk constraint which we need to explicitly overwrite. # The pub client defaults to an <2.0.0 sdk constraint which we need to explicitly overwrite.
sdk: ">=2.2.0 <3.0.0" sdk: ">=2.2.2 <3.0.0"
dependencies: dependencies:
flutter: flutter:
......
...@@ -2010,13 +2010,13 @@ abstract class RenderBox extends RenderObject { ...@@ -2010,13 +2010,13 @@ abstract class RenderBox extends RenderObject {
// TODO(jacobr): consider nesting the failures object so it is collapsible. // TODO(jacobr): consider nesting the failures object so it is collapsible.
throw FlutterError.fromParts(<DiagnosticsNode>[ throw FlutterError.fromParts(<DiagnosticsNode>[
ErrorSummary('The intrinsic dimension methods of the $runtimeType class returned values that violate the intrinsic protocol contract.'), ErrorSummary('The intrinsic dimension methods of the $runtimeType class returned values that violate the intrinsic protocol contract.'),
ErrorDescription('The following ${failures.length > 1 ? "failures" : "failure"} was detected:') // should this be tagged as an error or not? ErrorDescription('The following ${failures.length > 1 ? "failures" : "failure"} was detected:'), // should this be tagged as an error or not?
]..addAll(failures) ...failures,
..add(ErrorHint( ErrorHint(
'If you are not writing your own RenderBox subclass, then this is not\n' 'If you are not writing your own RenderBox subclass, then this is not\n'
'your fault. Contact support: https://github.com/flutter/flutter/issues/new?template=BUG.md' 'your fault. Contact support: https://github.com/flutter/flutter/issues/new?template=BUG.md'
)) ),
); ]);
} }
} }
return true; return true;
......
...@@ -708,12 +708,13 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl ...@@ -708,12 +708,13 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
' http://api.flutter.dev/flutter/rendering/debugDumpRenderTree.html' ' http://api.flutter.dev/flutter/rendering/debugDumpRenderTree.html'
), ),
describeForError('The affected RenderFlex is', style: DiagnosticsTreeStyle.errorProperty), describeForError('The affected RenderFlex is', style: DiagnosticsTreeStyle.errorProperty),
DiagnosticsProperty<dynamic>('The creator information is set to', debugCreator, style: DiagnosticsTreeStyle.errorProperty) DiagnosticsProperty<dynamic>('The creator information is set to', debugCreator, style: DiagnosticsTreeStyle.errorProperty),
]..addAll(addendum) ...addendum,
..add(ErrorDescription( ErrorDescription(
'If none of the above helps enough to fix this problem, please don\'t hesitate to file a bug:\n' 'If none of the above helps enough to fix this problem, please don\'t hesitate to file a bug:\n'
' https://github.com/flutter/flutter/issues/new?template=BUG.md' ' https://github.com/flutter/flutter/issues/new?template=BUG.md'
))); )
]);
}()); }());
totalFlex += childParentData.flex; totalFlex += childParentData.flex;
lastFlexChild = child; lastFlexChild = child;
......
...@@ -1204,15 +1204,16 @@ abstract class RenderSliver extends RenderObject { ...@@ -1204,15 +1204,16 @@ abstract class RenderSliver extends RenderObject {
if (geometry.paintExtent > constraints.remainingPaintExtent) { if (geometry.paintExtent > constraints.remainingPaintExtent) {
throw FlutterError.fromParts(<DiagnosticsNode>[ throw FlutterError.fromParts(<DiagnosticsNode>[
ErrorSummary('SliverGeometry has a paintOffset that exceeds the remainingPaintExtent from the constraints.'), ErrorSummary('SliverGeometry has a paintOffset that exceeds the remainingPaintExtent from the constraints.'),
describeForError('The render object whose geometry violates the constraints is the following') describeForError('The render object whose geometry violates the constraints is the following'),
]..addAll(_debugCompareFloats( ..._debugCompareFloats(
'remainingPaintExtent', constraints.remainingPaintExtent, 'remainingPaintExtent', constraints.remainingPaintExtent,
'paintExtent', geometry.paintExtent, 'paintExtent', geometry.paintExtent,
)) ),
..add(ErrorDescription( ErrorDescription(
'The paintExtent must cause the child sliver to paint within the viewport, and so ' 'The paintExtent must cause the child sliver to paint within the viewport, and so '
'cannot exceed the remainingPaintExtent.', 'cannot exceed the remainingPaintExtent.',
))); ),
]);
} }
return true; return true;
}()); }());
......
...@@ -344,10 +344,10 @@ class EditableText extends StatefulWidget { ...@@ -344,10 +344,10 @@ class EditableText extends StatefulWidget {
_strutStyle = strutStyle, _strutStyle = strutStyle,
keyboardType = keyboardType ?? (maxLines == 1 ? TextInputType.text : TextInputType.multiline), keyboardType = keyboardType ?? (maxLines == 1 ? TextInputType.text : TextInputType.multiline),
inputFormatters = maxLines == 1 inputFormatters = maxLines == 1
? ( ? <TextInputFormatter>[
<TextInputFormatter>[BlacklistingTextInputFormatter.singleLineFormatter] BlacklistingTextInputFormatter.singleLineFormatter,
..addAll(inputFormatters ?? const Iterable<TextInputFormatter>.empty()) ...inputFormatters ?? const Iterable<TextInputFormatter>.empty(),
) ]
: inputFormatters, : inputFormatters,
showCursor = showCursor ?? !readOnly, showCursor = showCursor ?? !readOnly,
super(key: key); super(key: key);
......
...@@ -122,22 +122,22 @@ void main() { ...@@ -122,22 +122,22 @@ void main() {
_checkEncoding<dynamic>( _checkEncoding<dynamic>(
standard, standard,
Uint8List(253), Uint8List(253),
<int>[8, 253]..addAll(List<int>.filled(253, 0)), <int>[8, 253, ...List<int>.filled(253, 0)],
); );
_checkEncoding<dynamic>( _checkEncoding<dynamic>(
standard, standard,
Uint8List(254), Uint8List(254),
<int>[8, 254, 254, 0]..addAll(List<int>.filled(254, 0)), <int>[8, 254, 254, 0, ...List<int>.filled(254, 0)],
); );
_checkEncoding<dynamic>( _checkEncoding<dynamic>(
standard, standard,
Uint8List(0xffff), Uint8List(0xffff),
<int>[8, 254, 0xff, 0xff]..addAll(List<int>.filled(0xffff, 0)), <int>[8, 254, 0xff, 0xff, ...List<int>.filled(0xffff, 0)],
); );
_checkEncoding<dynamic>( _checkEncoding<dynamic>(
standard, standard,
Uint8List(0xffff + 1), Uint8List(0xffff + 1),
<int>[8, 255, 0, 0, 1, 0]..addAll(List<int>.filled(0xffff + 1, 0)), <int>[8, 255, 0, 0, 1, 0, ...List<int>.filled(0xffff + 1, 0)],
); );
}); });
test('should encode and decode simple messages', () { test('should encode and decode simple messages', () {
......
...@@ -196,7 +196,8 @@ void main() { ...@@ -196,7 +196,8 @@ void main() {
title: Text('App Bar'), title: Text('App Bar'),
), ),
), ),
]..addAll(slivers), ...slivers,
],
); );
}, },
), ),
......
...@@ -113,16 +113,17 @@ void main() { ...@@ -113,16 +113,17 @@ void main() {
scrollMetrics: defaultMetrics, scrollMetrics: defaultMetrics,
); );
final List<ScrollMetrics> metricsList = final List<ScrollMetrics> metricsList = <ScrollMetrics> [
<ScrollMetrics> [startingMetrics.copyWith(pixels: 0.01)] startingMetrics.copyWith(pixels: 0.01),
..addAll(List<ScrollMetrics>.generate( ...List<ScrollMetrics>.generate(
(maxExtent/viewportDimension).round(), (maxExtent / viewportDimension).round(),
(int index) => startingMetrics.copyWith(pixels: (index + 1) * viewportDimension), (int index) => startingMetrics.copyWith(pixels: (index + 1) * viewportDimension),
).where((ScrollMetrics metrics) => !metrics.outOfRange)) ).where((ScrollMetrics metrics) => !metrics.outOfRange),
..add(startingMetrics.copyWith(pixels: maxExtent - 0.01)); startingMetrics.copyWith(pixels: maxExtent - 0.01),
];
double lastCoefficient; double lastCoefficient;
for(ScrollMetrics metrics in metricsList) { for (ScrollMetrics metrics in metricsList) {
painter.update(metrics, metrics.axisDirection); painter.update(metrics, metrics.axisDirection);
painter.paint(testCanvas, size); painter.paint(testCanvas, size);
......
...@@ -599,7 +599,8 @@ void _tests() { ...@@ -599,7 +599,8 @@ void _tests() {
expandedHeight: 100.0, expandedHeight: 100.0,
title: Text('AppBar'), title: Text('AppBar'),
), ),
]..addAll(slivers), ...slivers,
],
), ),
), ),
), ),
...@@ -824,7 +825,8 @@ void _tests() { ...@@ -824,7 +825,8 @@ void _tests() {
expandedHeight: 100.0, expandedHeight: 100.0,
title: Text('AppBar'), title: Text('AppBar'),
), ),
]..addAll(slivers), ...slivers,
],
), ),
), ),
), ),
......
...@@ -219,7 +219,7 @@ class AndroidDevice extends Device { ...@@ -219,7 +219,7 @@ class AndroidDevice extends Device {
_AndroidDevicePortForwarder _portForwarder; _AndroidDevicePortForwarder _portForwarder;
List<String> adbCommandForDevice(List<String> args) { List<String> adbCommandForDevice(List<String> args) {
return <String>[getAdbPath(androidSdk), '-s', id]..addAll(args); return <String>[getAdbPath(androidSdk), '-s', id, ...args];
} }
String runAdbCheckedSync( String runAdbCheckedSync(
......
...@@ -458,7 +458,7 @@ List<Font> _parsePackageFonts( ...@@ -458,7 +458,7 @@ List<Font> _parsePackageFonts(
)); ));
} else { } else {
packageFontAssets.add(FontAsset( packageFontAssets.add(FontAsset(
Uri(pathSegments: <String>['packages', packageName]..addAll(assetUri.pathSegments)), Uri(pathSegments: <String>['packages', packageName, ...assetUri.pathSegments]),
weight: fontAsset.weight, weight: fontAsset.weight,
style: fontAsset.style, style: fontAsset.style,
)); ));
...@@ -677,7 +677,7 @@ _Asset _resolveAsset( ...@@ -677,7 +677,7 @@ _Asset _resolveAsset(
baseDir: assetsBaseDir, baseDir: assetsBaseDir,
entryUri: packageName == null entryUri: packageName == null
? assetUri // Asset from the current application. ? assetUri // Asset from the current application.
: Uri(pathSegments: <String>['packages', packageName]..addAll(assetUri.pathSegments)), // Asset from, and declared in $packageName. : Uri(pathSegments: <String>['packages', packageName, ...assetUri.pathSegments]), // Asset from, and declared in $packageName.
relativeUri: assetUri, relativeUri: assetUri,
); );
} }
......
...@@ -51,7 +51,8 @@ class GenSnapshot { ...@@ -51,7 +51,8 @@ class GenSnapshot {
}) { }) {
final List<String> args = <String>[ final List<String> args = <String>[
'--causal_async_stacks', '--causal_async_stacks',
]..addAll(additionalArgs); ...additionalArgs,
];
final String snapshotterPath = getSnapshotterPath(snapshotType); final String snapshotterPath = getSnapshotterPath(snapshotType);
...@@ -61,7 +62,7 @@ class GenSnapshot { ...@@ -61,7 +62,7 @@ class GenSnapshot {
// architecture. // architecture.
if (snapshotType.platform == TargetPlatform.ios) { if (snapshotType.platform == TargetPlatform.ios) {
final String hostArch = iosArch == IOSArch.armv7 ? '-i386' : '-x86_64'; final String hostArch = iosArch == IOSArch.armv7 ? '-i386' : '-x86_64';
return runCommandAndStreamOutput(<String>['/usr/bin/arch', hostArch, snapshotterPath]..addAll(args)); return runCommandAndStreamOutput(<String>['/usr/bin/arch', hostArch, snapshotterPath, ...args]);
} }
StringConverter outputFilter; StringConverter outputFilter;
...@@ -72,8 +73,7 @@ class GenSnapshot { ...@@ -72,8 +73,7 @@ class GenSnapshot {
outputFilter = (String line) => line != kStripWarning ? line : null; outputFilter = (String line) => line != kStripWarning ? line : null;
} }
return runCommandAndStreamOutput(<String>[snapshotterPath]..addAll(args), return runCommandAndStreamOutput(<String>[snapshotterPath, ...args], mapFunction: outputFilter);
mapFunction: outputFilter);
} }
} }
...@@ -168,7 +168,7 @@ class AOTSnapshotter { ...@@ -168,7 +168,7 @@ class AOTSnapshotter {
// If inputs and outputs have not changed since last run, skip the build. // If inputs and outputs have not changed since last run, skip the build.
final Fingerprinter fingerprinter = Fingerprinter( final Fingerprinter fingerprinter = Fingerprinter(
fingerprintPath: '$depfilePath.fingerprint', fingerprintPath: '$depfilePath.fingerprint',
paths: <String>[mainPath]..addAll(inputPaths)..addAll(outputPaths), paths: <String>[mainPath, ...inputPaths, ...outputPaths],
properties: <String, String>{ properties: <String, String>{
'buildMode': buildMode.toString(), 'buildMode': buildMode.toString(),
'targetPlatform': platform.toString(), 'targetPlatform': platform.toString(),
...@@ -422,7 +422,7 @@ class JITSnapshotter { ...@@ -422,7 +422,7 @@ class JITSnapshotter {
// If inputs and outputs have not changed since last run, skip the build. // If inputs and outputs have not changed since last run, skip the build.
final Fingerprinter fingerprinter = Fingerprinter( final Fingerprinter fingerprinter = Fingerprinter(
fingerprintPath: '$depfilePath.fingerprint', fingerprintPath: '$depfilePath.fingerprint',
paths: <String>[mainPath]..addAll(inputPaths)..addAll(outputPaths), paths: <String>[mainPath, ...inputPaths, ...outputPaths],
properties: <String, String>{ properties: <String, String>{
'buildMode': buildMode.toString(), 'buildMode': buildMode.toString(),
'targetPlatform': platform.toString(), 'targetPlatform': platform.toString(),
......
...@@ -923,7 +923,7 @@ String _flattenNameNoSubdirs(String fileName) { ...@@ -923,7 +923,7 @@ String _flattenNameNoSubdirs(String fileName) {
@visibleForTesting @visibleForTesting
String flattenNameSubdirs(Uri url) { String flattenNameSubdirs(Uri url) {
final List<String> pieces = <String>[url.host]..addAll(url.pathSegments); final List<String> pieces = <String>[url.host, ...url.pathSegments];
final Iterable<String> convertedPieces = pieces.map<String>(_flattenNameNoSubdirs); final Iterable<String> convertedPieces = pieces.map<String>(_flattenNameNoSubdirs);
return fs.path.joinAll(convertedPieces); return fs.path.joinAll(convertedPieces);
} }
......
...@@ -127,10 +127,13 @@ class BuildAotCommand extends BuildSubCommand with TargetPlatformBasedDevelopmen ...@@ -127,10 +127,13 @@ class BuildAotCommand extends BuildSubCommand with TargetPlatformBasedDevelopmen
if ((await Future.wait<int>(exitCodes.values)).every((int buildExitCode) => buildExitCode == 0)) { if ((await Future.wait<int>(exitCodes.values)).every((int buildExitCode) => buildExitCode == 0)) {
final Iterable<String> dylibs = iosBuilds.values.map<String>((String outputDir) => fs.path.join(outputDir, 'App.framework', 'App')); final Iterable<String> dylibs = iosBuilds.values.map<String>((String outputDir) => fs.path.join(outputDir, 'App.framework', 'App'));
fs.directory(fs.path.join(outputPath, 'App.framework'))..createSync(); fs.directory(fs.path.join(outputPath, 'App.framework'))..createSync();
await runCheckedAsync(<String>['lipo'] await runCheckedAsync(<String>[
..addAll(dylibs) 'lipo',
..addAll(<String>['-create', '-output', fs.path.join(outputPath, 'App.framework', 'App')]), ...dylibs,
); '-create',
'-output',
fs.path.join(outputPath, 'App.framework', 'App'),
]);
} else { } else {
status?.cancel(); status?.cancel();
exitCodes.forEach((IOSArch iosArch, Future<int> exitCodeFuture) async { exitCodes.forEach((IOSArch iosArch, Future<int> exitCodeFuture) async {
......
...@@ -182,7 +182,7 @@ class DriveCommand extends RunCommandBase { ...@@ -182,7 +182,7 @@ class DriveCommand extends RunCommandBase {
// if the application is `lib/foo/bar.dart`, the test file is expected to // if the application is `lib/foo/bar.dart`, the test file is expected to
// be `test_driver/foo/bar_test.dart`. // be `test_driver/foo/bar_test.dart`.
final String pathWithNoExtension = fs.path.withoutExtension(fs.path.joinAll( final String pathWithNoExtension = fs.path.withoutExtension(fs.path.joinAll(
<String>[packageDir, 'test_driver']..addAll(parts.skip(1)))); <String>[packageDir, 'test_driver', ...parts.skip(1)]));
return '${pathWithNoExtension}_test${fs.path.extension(appFile)}'; return '${pathWithNoExtension}_test${fs.path.extension(appFile)}';
} }
} }
...@@ -297,13 +297,13 @@ Future<void> _runTests(List<String> testArgs, String observatoryUri) async { ...@@ -297,13 +297,13 @@ Future<void> _runTests(List<String> testArgs, String observatoryUri) async {
PackageMap.globalPackagesPath = fs.path.normalize(fs.path.absolute(PackageMap.globalPackagesPath)); PackageMap.globalPackagesPath = fs.path.normalize(fs.path.absolute(PackageMap.globalPackagesPath));
final String dartVmPath = fs.path.join(dartSdkPath, 'bin', 'dart'); final String dartVmPath = fs.path.join(dartSdkPath, 'bin', 'dart');
final int result = await runCommandAndStreamOutput( final int result = await runCommandAndStreamOutput(
<String>[dartVmPath] <String>[
..addAll(dartVmFlags) dartVmPath,
..addAll(testArgs) ...dartVmFlags,
..addAll(<String>[ ...testArgs,
'--packages=${PackageMap.globalPackagesPath}', '--packages=${PackageMap.globalPackagesPath}',
'-rexpanded', '-rexpanded',
]), ],
environment: <String, String>{'VM_SERVICE_URL': observatoryUri}, environment: <String, String>{'VM_SERVICE_URL': observatoryUri},
); );
if (result != 0) if (result != 0)
......
...@@ -163,7 +163,7 @@ class PackagesTestCommand extends FlutterCommand { ...@@ -163,7 +163,7 @@ class PackagesTestCommand extends FlutterCommand {
@override @override
Future<FlutterCommandResult> runCommand() async { Future<FlutterCommandResult> runCommand() async {
await pub(<String>['run', 'test']..addAll(argResults.rest), context: PubContext.runTest, retry: false); await pub(<String>['run', 'test', ...argResults.rest], context: PubContext.runTest, retry: false);
return null; return null;
} }
} }
...@@ -193,7 +193,7 @@ class PackagesForwardCommand extends FlutterCommand { ...@@ -193,7 +193,7 @@ class PackagesForwardCommand extends FlutterCommand {
@override @override
Future<FlutterCommandResult> runCommand() async { Future<FlutterCommandResult> runCommand() async {
await pub(<String>[_commandName]..addAll(argResults.rest), context: PubContext.pubForward, retry: false); await pub(<String>[_commandName, ...argResults.rest], context: PubContext.pubForward, retry: false);
return null; return null;
} }
......
...@@ -192,7 +192,7 @@ Future<void> pubInteractively( ...@@ -192,7 +192,7 @@ Future<void> pubInteractively(
/// The command used for running pub. /// The command used for running pub.
List<String> _pubCommand(List<String> arguments) { List<String> _pubCommand(List<String> arguments) {
return <String>[ sdkBinaryName('pub') ]..addAll(arguments); return <String>[sdkBinaryName('pub'), ...arguments];
} }
/// The full environment used when running pub. /// The full environment used when running pub.
......
...@@ -84,9 +84,10 @@ class FuchsiaKernelCompiler { ...@@ -84,9 +84,10 @@ class FuchsiaKernelCompiler {
]; ];
final List<String> command = <String>[ final List<String> command = <String>[
artifacts.getArtifactPath(Artifact.engineDartBinary), artifacts.getArtifactPath(Artifact.engineDartBinary),
fuchsiaArtifacts.kernelCompiler.path, fuchsiaArtifacts.kernelCompiler.path,
]..addAll(flags); ...flags,
];
final Process process = await runCommand(command); final Process process = await runCommand(command);
final Status status = logger.startProgress( final Status status = logger.startProgress(
'Building Fuchsia application...', 'Building Fuchsia application...',
......
...@@ -90,11 +90,11 @@ class Xcode { ...@@ -90,11 +90,11 @@ class Xcode {
} }
Future<RunResult> cc(List<String> args) { Future<RunResult> cc(List<String> args) {
return runCheckedAsync(<String>['xcrun', 'cc']..addAll(args)); return runCheckedAsync(<String>['xcrun', 'cc', ...args]);
} }
Future<RunResult> clang(List<String> args) { Future<RunResult> clang(List<String> args) {
return runCheckedAsync(<String>['xcrun', 'clang']..addAll(args)); return runCheckedAsync(<String>['xcrun', 'clang', ...args]);
} }
String getSimulatorPath() { String getSimulatorPath() {
......
...@@ -17,7 +17,7 @@ void main() { ...@@ -17,7 +17,7 @@ void main() {
Cache.disableLocking(); Cache.disableLocking();
Future<void> runCommand(Iterable<String> flags, _TestMethod testMethod) async { Future<void> runCommand(Iterable<String> flags, _TestMethod testMethod) async {
final List<String> args = <String>['test']..addAll(flags); final List<String> args = <String>['test', ...flags];
final _TestCommand command = _TestCommand(testMethod); final _TestCommand command = _TestCommand(testMethod);
await createTestCommandRunner(command).run(args); await createTestCommandRunner(command).run(args);
} }
......
...@@ -1169,10 +1169,11 @@ Future<void> _analyzeProject(String workingDir) async { ...@@ -1169,10 +1169,11 @@ Future<void> _analyzeProject(String workingDir) async {
'flutter_tools.dart', 'flutter_tools.dart',
)); ));
final List<String> args = <String>[] final List<String> args = <String>[
..addAll(dartVmFlags) ...dartVmFlags,
..add(flutterToolsPath) flutterToolsPath,
..add('analyze'); 'analyze',
];
final ProcessResult exec = await Process.run( final ProcessResult exec = await Process.run(
'$dartSdkPath/bin/dart', '$dartSdkPath/bin/dart',
...@@ -1196,21 +1197,22 @@ Future<void> _runFlutterTest(Directory workingDir, { String target }) async { ...@@ -1196,21 +1197,22 @@ Future<void> _runFlutterTest(Directory workingDir, { String target }) async {
// files anymore. // files anymore.
await Process.run( await Process.run(
'$dartSdkPath/bin/dart', '$dartSdkPath/bin/dart',
<String>[] <String>[
..addAll(dartVmFlags) ...dartVmFlags,
..add(flutterToolsPath) flutterToolsPath,
..addAll(<String>['packages', 'get']), 'packages',
'get',
],
workingDirectory: workingDir.path, workingDirectory: workingDir.path,
); );
final List<String> args = <String>[] final List<String> args = <String>[
..addAll(dartVmFlags) ...dartVmFlags,
..add(flutterToolsPath) flutterToolsPath,
..add('test') 'test',
..add('--no-color'); '--no-color',
if (target != null) { if (target != null) target,
args.add(target); ];
}
final ProcessResult exec = await Process.run( final ProcessResult exec = await Process.run(
'$dartSdkPath/bin/dart', '$dartSdkPath/bin/dart',
......
...@@ -172,13 +172,14 @@ Future<ProcessResult> _runFlutterTest( ...@@ -172,13 +172,14 @@ Future<ProcessResult> _runFlutterTest(
if (!testFile.existsSync()) if (!testFile.existsSync())
fail('missing test file: $testFile'); fail('missing test file: $testFile');
final List<String> args = <String>[] final List<String> args = <String>[
..addAll(dartVmFlags) ...dartVmFlags,
..add(fs.path.absolute(fs.path.join('bin', 'flutter_tools.dart'))) fs.path.absolute(fs.path.join('bin', 'flutter_tools.dart')),
..add('test') 'test',
..add('--no-color') '--no-color',
..addAll(extraArgs) ...extraArgs,
..add(testFilePath); testFilePath
];
while (_testExclusionLock != null) while (_testExclusionLock != null)
await _testExclusionLock; await _testExclusionLock;
......
...@@ -131,7 +131,7 @@ Future<String> createProject(Directory temp, { List<String> arguments }) async { ...@@ -131,7 +131,7 @@ Future<String> createProject(Directory temp, { List<String> arguments }) async {
final String projectPath = fs.path.join(temp.path, 'flutter_project'); final String projectPath = fs.path.join(temp.path, 'flutter_project');
final CreateCommand command = CreateCommand(); final CreateCommand command = CreateCommand();
final CommandRunner<void> runner = createTestCommandRunner(command); final CommandRunner<void> runner = createTestCommandRunner(command);
await runner.run(<String>['create']..addAll(arguments)..add(projectPath)); await runner.run(<String>['create', ...arguments, projectPath]);
return projectPath; return projectPath;
} }
......
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