fix analysis errors (#3677) * fix analysis errors * review comments; fix test * re-add an export for debugPrint
diff --git a/packages/flutter_tools/lib/src/android/adb.dart b/packages/flutter_tools/lib/src/android/adb.dart index afaf6a8..aa939b5 100644 --- a/packages/flutter_tools/lib/src/android/adb.dart +++ b/packages/flutter_tools/lib/src/android/adb.dart
@@ -23,7 +23,7 @@ bool exists() { try { - runCheckedSync([adbPath, 'version']); + runCheckedSync(<String>[adbPath, 'version']); return true; } catch (exception) { return false; @@ -36,18 +36,18 @@ /// Revision eac51f2bb6a8-android /// /// This method throws if `adb version` fails. - String getVersion() => runCheckedSync([adbPath, 'version']); + String getVersion() => runCheckedSync(<String>[adbPath, 'version']); /// Starts the adb server. This will throw if there's an problem starting the /// adb server. void startServer() { - runCheckedSync([adbPath, 'start-server']); + runCheckedSync(<String>[adbPath, 'start-server']); } /// Stops the adb server. This will throw if there's an problem stopping the /// adb server. void killServer() { - runCheckedSync([adbPath, 'kill-server']); + runCheckedSync(<String>[adbPath, 'kill-server']); } /// Ask the ADB server for its internal version number.
diff --git a/packages/flutter_tools/lib/src/android/android_device.dart b/packages/flutter_tools/lib/src/android/android_device.dart index 7a63f4c..ced99aa 100644 --- a/packages/flutter_tools/lib/src/android/android_device.dart +++ b/packages/flutter_tools/lib/src/android/android_device.dart
@@ -56,7 +56,9 @@ if (_isLocalEmulator == null) { // http://developer.android.com/ndk/guides/abis.html (x86, armeabi-v7a, ...) try { - String value = runCheckedSync(adbCommandForDevice(['shell', 'getprop', 'ro.product.cpu.abi'])); + String value = runCheckedSync(adbCommandForDevice( + <String>['shell', 'getprop', 'ro.product.cpu.abi'] + )); _isLocalEmulator = value.startsWith('x86'); } catch (error) { _isLocalEmulator = false; @@ -164,7 +166,7 @@ @override bool isAppInstalled(ApplicationPackage app) { // This call takes 400ms - 600ms. - if (runCheckedSync(adbCommandForDevice(['shell', 'pm', 'path', app.id])).isEmpty) + if (runCheckedSync(adbCommandForDevice(<String>['shell', 'pm', 'path', app.id])).isEmpty) return false; // Check the application SHA. @@ -405,7 +407,7 @@ /// /// [mockAdbOutput] is public for testing. List<AndroidDevice> getAdbDevices({ String mockAdbOutput }) { - List<AndroidDevice> devices = []; + List<AndroidDevice> devices = <AndroidDevice>[]; List<String> output; if (mockAdbOutput == null) {
diff --git a/packages/flutter_tools/lib/src/base/context.dart b/packages/flutter_tools/lib/src/base/context.dart index 87b9da4..e00e08c 100644 --- a/packages/flutter_tools/lib/src/base/context.dart +++ b/packages/flutter_tools/lib/src/base/context.dart
@@ -57,6 +57,6 @@ } dynamic runInZone(dynamic method()) { - return runZoned(method, zoneValues: {'context': this}); + return runZoned(method, zoneValues: <String, dynamic>{'context': this}); } }
diff --git a/packages/flutter_tools/lib/src/base/os.dart b/packages/flutter_tools/lib/src/base/os.dart index e268b6c..ccd227b 100644 --- a/packages/flutter_tools/lib/src/base/os.dart +++ b/packages/flutter_tools/lib/src/base/os.dart
@@ -48,7 +48,7 @@ @override ProcessResult makeExecutable(File file) { - return Process.runSync('chmod', ['a+x', file.path]); + return Process.runSync('chmod', <String>['a+x', file.path]); } /// Return the path (with symlinks resolved) to the given executable, or `null`
diff --git a/packages/flutter_tools/lib/src/base/process.dart b/packages/flutter_tools/lib/src/base/process.dart index adaf504..7c478f7 100644 --- a/packages/flutter_tools/lib/src/base/process.dart +++ b/packages/flutter_tools/lib/src/base/process.dart
@@ -18,7 +18,7 @@ Future<Process> runCommand(List<String> cmd, { String workingDirectory }) async { printTrace(cmd.join(' ')); String executable = cmd[0]; - List<String> arguments = cmd.length > 1 ? cmd.sublist(1) : []; + List<String> arguments = cmd.length > 1 ? cmd.sublist(1) : <String>[]; Process process = await Process.start( executable, arguments,
diff --git a/packages/flutter_tools/lib/src/cache.dart b/packages/flutter_tools/lib/src/cache.dart index ec976ce..892657b 100644 --- a/packages/flutter_tools/lib/src/cache.dart +++ b/packages/flutter_tools/lib/src/cache.dart
@@ -206,12 +206,12 @@ // Return a list of (cache directory path, download URL path) tuples. List<List<String>> _getToolsDirs() { if (Platform.isMacOS) - return <List<String>>[['darwin-x64', 'darwin-x64/artifacts.zip']]; + return <List<String>>[<String>['darwin-x64', 'darwin-x64/artifacts.zip']]; else if (Platform.isLinux) return <List<String>>[ - ['linux-x64', 'linux-x64/artifacts.zip'], - ['android-arm-profile/linux-x64', 'android-arm-profile/linux-x64.zip'], - ['android-arm-release/linux-x64', 'android-arm-release/linux-x64.zip'], + <String>['linux-x64', 'linux-x64/artifacts.zip'], + <String>['android-arm-profile/linux-x64', 'android-arm-profile/linux-x64.zip'], + <String>['android-arm-release/linux-x64', 'android-arm-release/linux-x64.zip'], ]; else return <List<String>>[];
diff --git a/packages/flutter_tools/lib/src/commands/build_aot.dart b/packages/flutter_tools/lib/src/commands/build_aot.dart index 63ae570..df010a3 100644 --- a/packages/flutter_tools/lib/src/commands/build_aot.dart +++ b/packages/flutter_tools/lib/src/commands/build_aot.dart
@@ -107,7 +107,7 @@ String vmServicePath = path.join(skyEngineSdkExt, 'dart', 'runtime', 'bin', 'vmservice', 'vmservice_io.dart'); String jniPath = path.join(skyEngineSdkExt, 'dart_jni', 'jni.dart'); - List<String> filePaths = [ + List<String> filePaths = <String>[ genSnapshot, vmEntryPoints, vmEntryPointsAndroid, mojoInternalPath, uiPath, vmServicePath, jniPath ]; List<String> missingFiles = filePaths.where((String p) => !FileSystemEntity.isFileSync(p)).toList(); @@ -116,7 +116,7 @@ return null; } - List<String> genSnapshotCmd = [ + List<String> genSnapshotCmd = <String>[ genSnapshot, '--vm_isolate_snapshot=$vmIsolateSnapshot', '--isolate_snapshot=$isolateSnapshot', @@ -133,7 +133,7 @@ ]; if (!(tools.engineRelease || buildMode == BuildMode.release)) { - genSnapshotCmd.addAll([ + genSnapshotCmd.addAll(<String>[ '--no-checked', '--conditional_directives', ]);
diff --git a/packages/flutter_tools/lib/src/commands/build_apk.dart b/packages/flutter_tools/lib/src/commands/build_apk.dart index f784dd5..f5fa04e 100644 --- a/packages/flutter_tools/lib/src/commands/build_apk.dart +++ b/packages/flutter_tools/lib/src/commands/build_apk.dart
@@ -111,7 +111,7 @@ '-F', outputApk.path, ]; if (resources != null) - packageArgs.addAll(['-S', resources.absolute.path]); + packageArgs.addAll(<String>['-S', resources.absolute.path]); packageArgs.add(artifacts.path); runCheckedSync(packageArgs); } @@ -136,7 +136,7 @@ File manifest; File icuData; List<File> jars; - List<Map<String, String>> services = []; + List<Map<String, String>> services = <Map<String, String>>[]; File libSkyShell; File debugKeystore; Directory resources; @@ -408,7 +408,7 @@ // Note: This list of dependencies is imperfect, but will do for now. We // purposely don't include the .dart files, because we can load those // over the network without needing to rebuild (at least on Android). - Iterable<FileStat> dependenciesStat = [ + Iterable<FileStat> dependenciesStat = <String>[ manifest, _kFlutterManifestPath, _kPackagesStatusPath
diff --git a/packages/flutter_tools/lib/src/commands/daemon.dart b/packages/flutter_tools/lib/src/commands/daemon.dart index 72c9afe..6a8e8a3 100644 --- a/packages/flutter_tools/lib/src/commands/daemon.dart +++ b/packages/flutter_tools/lib/src/commands/daemon.dart
@@ -135,7 +135,7 @@ _domainMap[prefix].handleCommand(name, id, request['params']); } catch (error) { - _send({'id': id, 'error': _toJsonable(error)}); + _send(<String, dynamic>{'id': id, 'error': _toJsonable(error)}); } } @@ -181,7 +181,7 @@ } void sendEvent(String name, [dynamic args]) { - Map<String, dynamic> map = { 'event': name }; + Map<String, dynamic> map = <String, dynamic>{ 'event': name }; if (args != null) map['params'] = _toJsonable(args); _send(map); @@ -202,13 +202,13 @@ _subscription = daemon.notifyingLogger.onMessage.listen((LogMessage message) { if (message.stackTrace != null) { - sendEvent('daemon.logMessage', { + sendEvent('daemon.logMessage', <String, dynamic>{ 'level': message.level, 'message': message.message, 'stackTrace': message.stackTrace.toString() }); } else { - sendEvent('daemon.logMessage', { + sendEvent('daemon.logMessage', <String, dynamic>{ 'level': message.level, 'message': message.message });
diff --git a/packages/flutter_tools/lib/src/commands/drive.dart b/packages/flutter_tools/lib/src/commands/drive.dart index 4a0a995..7451bc4 100644 --- a/packages/flutter_tools/lib/src/commands/drive.dart +++ b/packages/flutter_tools/lib/src/commands/drive.dart
@@ -109,7 +109,7 @@ } try { - return await testRunner([testFile]) + return await testRunner(<String>[testFile]) .catchError((dynamic error, dynamic stackTrace) { printError('CAUGHT EXCEPTION: $error\n$stackTrace'); return 1; @@ -162,7 +162,7 @@ // if the application is `lib/foo/bar.dart`, the test file is expected to // be `test_driver/foo/bar_test.dart`. String pathWithNoExtension = path.withoutExtension(path.joinAll( - [packageDir, 'test_driver']..addAll(parts.skip(1)))); + <String>[packageDir, 'test_driver']..addAll(parts.skip(1)))); return '${pathWithNoExtension}_test${path.extension(appFile)}'; } }
diff --git a/packages/flutter_tools/lib/src/device.dart b/packages/flutter_tools/lib/src/device.dart index 20a3a98..2d9d5f7 100644 --- a/packages/flutter_tools/lib/src/device.dart +++ b/packages/flutter_tools/lib/src/device.dart
@@ -247,12 +247,12 @@ } await client.sendRequest('_setVMTimelineFlags', - {'recordedStreams': ['Compiler', 'Dart', 'Embedder', 'GC']} + <String, dynamic>{'recordedStreams': <String>['Compiler', 'Dart', 'Embedder', 'GC']} ); await client.sendRequest('_clearVMTimeline'); } - /// Stops tracing, optionally waiting + /// Stops tracing, optionally waiting Future<Map<String, dynamic>> stopTracingAndDownloadTimeline(int observatoryPort, {bool waitForFirstFrame: false}) async { rpc.Peer peer; try { @@ -270,7 +270,7 @@ if (!waitForFirstFrame) { // Stop tracing immediately and get the timeline - await peer.sendRequest('_setVMTimelineFlags', {'recordedStreams': '[]'}); + await peer.sendRequest('_setVMTimelineFlags', <String, dynamic>{'recordedStreams': '[]'}); timeline = await fetchTimeline(); } else { Completer<Null> whenFirstFrameRendered = new Completer<Null>(); @@ -285,7 +285,7 @@ } } }); - await peer.sendRequest('streamListen', {'streamId': 'Timeline'}); + await peer.sendRequest('streamListen', <String, dynamic>{'streamId': 'Timeline'}); await whenFirstFrameRendered.future.timeout( const Duration(seconds: 10), onTimeout: () { @@ -298,7 +298,7 @@ } ); timeline = await fetchTimeline(); - await peer.sendRequest('_setVMTimelineFlags', {'recordedStreams': '[]'}); + await peer.sendRequest('_setVMTimelineFlags', <String, dynamic>{'recordedStreams': '[]'}); } return timeline;
diff --git a/packages/flutter_tools/lib/src/ios/devices.dart b/packages/flutter_tools/lib/src/ios/devices.dart index 00b9d6a..fb06f29d 100644 --- a/packages/flutter_tools/lib/src/ios/devices.dart +++ b/packages/flutter_tools/lib/src/ios/devices.dart
@@ -81,7 +81,7 @@ if (!doctor.iosWorkflow.hasIDeviceId) return <IOSDevice>[]; - List<IOSDevice> devices = []; + List<IOSDevice> devices = <IOSDevice>[]; for (String id in _getAttachedDeviceIDs(mockIOS)) { String name = _getDeviceName(id, mockIOS); devices.add(new IOSDevice(id, name: name)); @@ -92,7 +92,7 @@ static Iterable<String> _getAttachedDeviceIDs([IOSDevice mockIOS]) { String listerPath = (mockIOS != null) ? mockIOS.listerPath : _checkForCommand('idevice_id'); try { - String output = runSync([listerPath, '-l']); + String output = runSync(<String>[listerPath, '-l']); return output.trim().split('\n').where((String s) => s != null && s.isNotEmpty); } catch (e) { return <String>[]; @@ -103,17 +103,17 @@ String informerPath = (mockIOS != null) ? mockIOS.informerPath : _checkForCommand('ideviceinfo'); - return runSync([informerPath, '-k', 'DeviceName', '-u', deviceID]).trim(); + return runSync(<String>[informerPath, '-k', 'DeviceName', '-u', deviceID]).trim(); } - static final Map<String, String> _commandMap = {}; + static final Map<String, String> _commandMap = <String, String>{}; static String _checkForCommand( String command, [ String macInstructions = _ideviceinstallerInstructions ]) { return _commandMap.putIfAbsent(command, () { try { - command = runCheckedSync(['which', command]).trim(); + command = runCheckedSync(<String>['which', command]).trim(); } catch (e) { if (Platform.isMacOS) { printError('$command not found. $macInstructions'); @@ -128,7 +128,7 @@ @override bool installApp(ApplicationPackage app) { try { - runCheckedSync([installerPath, '-i', app.localPath]); + runCheckedSync(<String>[installerPath, '-i', app.localPath]); return true; } catch (e) { return false; @@ -142,7 +142,7 @@ @override bool isAppInstalled(ApplicationPackage app) { try { - String apps = runCheckedSync([installerPath, '--list-apps']); + String apps = runCheckedSync(<String>[installerPath, '--list-apps']); if (new RegExp(app.id, multiLine: true).hasMatch(apps)) { return true; } @@ -181,7 +181,7 @@ } // Step 3: Attempt to install the application on the device. - int installationResult = await runCommandAndStreamOutput([ + int installationResult = await runCommandAndStreamOutput(<String>[ '/usr/bin/env', 'ios-deploy', '--id',
diff --git a/packages/flutter_tools/lib/src/ios/mac.dart b/packages/flutter_tools/lib/src/ios/mac.dart index b7fe3a0..8d8bffc 100644 --- a/packages/flutter_tools/lib/src/ios/mac.dart +++ b/packages/flutter_tools/lib/src/ios/mac.dart
@@ -207,7 +207,7 @@ } Future<Null> _addServicesToBundle(Directory bundle) async { - List<Map<String, String>> services = []; + List<Map<String, String>> services = <Map<String, String>>[]; printTrace("Trying to resolve native pub services."); // Step 1: Parse the service configuration yaml files present in the service @@ -237,18 +237,18 @@ continue; } // Shell out so permissions on the dylib are preserved. - runCheckedSync(['/bin/cp', dylib.path, frameworksDirectory.path]); + runCheckedSync(<String>['/bin/cp', dylib.path, frameworksDirectory.path]); } } void _copyServiceDefinitionsManifest(List<Map<String, String>> services, File manifest) { printTrace("Creating service definitions manifest at '${manifest.path}'"); - List<Map<String, String>> jsonServices = services.map((Map<String, String> service) => { + List<Map<String, String>> jsonServices = services.map((Map<String, String> service) => <String, String>{ 'name': service['name'], // Since we have already moved it to the Frameworks directory. Strip away // the directory and basenames. 'framework': path.basenameWithoutExtension(service['ios-framework']) }).toList(); - Map<String, dynamic> json = { 'services' : jsonServices }; + Map<String, dynamic> json = <String, dynamic>{ 'services' : jsonServices }; manifest.writeAsStringSync(JSON.encode(json), mode: FileMode.WRITE, flush: true); }
diff --git a/packages/flutter_tools/lib/src/ios/setup_xcodeproj.dart b/packages/flutter_tools/lib/src/ios/setup_xcodeproj.dart index 67e82dd..e8d68b1 100644 --- a/packages/flutter_tools/lib/src/ios/setup_xcodeproj.dart +++ b/packages/flutter_tools/lib/src/ios/setup_xcodeproj.dart
@@ -36,7 +36,7 @@ dir.createSync(recursive: true); // Unzip the Xcode project into the new empty directory - runCheckedSync(['/usr/bin/unzip', tempFile.path, '-d', dir.path]); + runCheckedSync(<String>['/usr/bin/unzip', tempFile.path, '-d', dir.path]); } catch (error) { printTrace('$error'); return false;
diff --git a/packages/flutter_tools/lib/src/ios/simulators.dart b/packages/flutter_tools/lib/src/ios/simulators.dart index a55a74a..622dd58 100644 --- a/packages/flutter_tools/lib/src/ios/simulators.dart +++ b/packages/flutter_tools/lib/src/ios/simulators.dart
@@ -71,7 +71,7 @@ // "template" is but the built-in 'Blank' seems to work. -l causes xcrun to // quit after a time limit without killing the simulator. We quit after // 1 second. - List<String> args = [_xcrunPath, 'instruments', '-w', deviceName, '-t', 'Blank', '-l', '1']; + List<String> args = <String>[_xcrunPath, 'instruments', '-w', deviceName, '-t', 'Blank', '-l', '1']; printTrace(args.join(' ')); runDetached(args); printStatus('Waiting for iOS Simulator to boot...'); @@ -112,7 +112,7 @@ // Create new device String deviceName = '${deviceType.name} $_kFlutterTestDeviceSuffix'; - List<String> args = [_xcrunPath, 'simctl', 'create', deviceName, deviceType.identifier, runtime]; + List<String> args = <String>[_xcrunPath, 'simctl', 'create', deviceName, deviceType.identifier, runtime]; printTrace(args.join(' ')); runCheckedSync(args); @@ -275,11 +275,11 @@ bool _isAnyConnected() => getConnectedDevices().isNotEmpty; void install(String deviceId, String appPath) { - runCheckedSync([_xcrunPath, 'simctl', 'install', deviceId, appPath]); + runCheckedSync(<String>[_xcrunPath, 'simctl', 'install', deviceId, appPath]); } void launch(String deviceId, String appIdentifier, [List<String> launchArgs]) { - List<String> args = [_xcrunPath, 'simctl', 'launch', deviceId, appIdentifier]; + List<String> args = <String>[_xcrunPath, 'simctl', 'launch', deviceId, appIdentifier]; if (launchArgs != null) args.addAll(launchArgs); runCheckedSync(args); @@ -508,7 +508,7 @@ } bool _applicationIsInstalledAndRunning(ApplicationPackage app) { - bool isInstalled = exitsHappy([ + bool isInstalled = exitsHappy(<String>[ 'xcrun', 'simctl', 'get_app_container', @@ -516,7 +516,7 @@ app.id, ]); - bool isRunning = exitsHappy([ + bool isRunning = exitsHappy(<String>[ '/usr/bin/killall', 'Runner', ]);
diff --git a/packages/flutter_tools/lib/src/runner/flutter_command.dart b/packages/flutter_tools/lib/src/runner/flutter_command.dart index 71f6dd1..8bc1e56 100644 --- a/packages/flutter_tools/lib/src/runner/flutter_command.dart +++ b/packages/flutter_tools/lib/src/runner/flutter_command.dart
@@ -74,7 +74,7 @@ } BuildMode getBuildMode() { - List<bool> modeFlags = [argResults['debug'], argResults['profile'], argResults['release']]; + List<bool> modeFlags = <bool>[argResults['debug'], argResults['profile'], argResults['release']]; if (modeFlags.where((bool flag) => flag).length > 1) throw new UsageException('Only one of --debug, --profile, or --release should be specified.', null);
diff --git a/packages/flutter_tools/lib/src/services.dart b/packages/flutter_tools/lib/src/services.dart index f041293..63ac3f4 100644 --- a/packages/flutter_tools/lib/src/services.dart +++ b/packages/flutter_tools/lib/src/services.dart
@@ -51,7 +51,7 @@ } for (Map<String, String> service in serviceConfig['services']) { - services.add({ + services.add(<String, String>{ 'root': serviceRoot, 'name': service['name'], 'android-class': service['android-class'], @@ -92,12 +92,12 @@ String dir, List<Map<String, String>> servicesIn ) { List<Map<String, String>> services = - servicesIn.map((Map<String, String> service) => { + servicesIn.map((Map<String, String> service) => <String, String>{ 'name': service['name'], 'class': service['android-class'] }).toList(); - Map<String, dynamic> json = { 'services': services }; + Map<String, dynamic> json = <String, dynamic>{ 'services': services }; File servicesFile = new File(path.join(dir, 'services.json')); servicesFile.writeAsStringSync(JSON.encode(json), mode: FileMode.WRITE, flush: true); return servicesFile;
diff --git a/packages/flutter_tools/lib/src/test/flutter_platform.dart b/packages/flutter_tools/lib/src/test/flutter_platform.dart index b890b44..2d0c0c3 100644 --- a/packages/flutter_tools/lib/src/test/flutter_platform.dart +++ b/packages/flutter_tools/lib/src/test/flutter_platform.dart
@@ -23,7 +23,7 @@ String shellPath; void installHook() { - hack.registerPlatformPlugin([TestPlatform.vm], () => new FlutterPlatform()); + hack.registerPlatformPlugin(<TestPlatform>[TestPlatform.vm], () => new FlutterPlatform()); } class _ServerInfo { @@ -46,7 +46,7 @@ Future<Process> _startProcess(String mainPath, { String packages }) { assert(shellPath != null || _kSkyShell != null); // Please provide the path to the shell in the SKY_SHELL environment variable. - return Process.start(shellPath ?? _kSkyShell, [ + return Process.start(shellPath ?? _kSkyShell, <String>[ '--enable-checked-mode', '--non-interactive', '--packages=$packages',
diff --git a/packages/flutter_tools/lib/src/toolchain.dart b/packages/flutter_tools/lib/src/toolchain.dart index 92ecb98..7c87656 100644 --- a/packages/flutter_tools/lib/src/toolchain.dart +++ b/packages/flutter_tools/lib/src/toolchain.dart
@@ -29,7 +29,7 @@ assert(mainPath != null); assert(snapshotPath != null); - final List<String> args = [ + final List<String> args = <String>[ _path, mainPath, '--packages=${PackageMap.instance.packagesPath}',
diff --git a/packages/flutter_tools/test/analyze_duplicate_names_test.dart b/packages/flutter_tools/test/analyze_duplicate_names_test.dart index 26e8218..0676e25 100644 --- a/packages/flutter_tools/test/analyze_duplicate_names_test.dart +++ b/packages/flutter_tools/test/analyze_duplicate_names_test.dart
@@ -35,7 +35,9 @@ AnalyzeCommand command = new AnalyzeCommand(); applyMocksToCommand(command); - return createTestCommandRunner(command).run(['analyze', '--no-current-package', '--no-current-directory', dartFileA.path, dartFileB.path]).then((int code) { + return createTestCommandRunner(command).run( + <String>['analyze', '--no-current-package', '--no-current-directory', dartFileA.path, dartFileB.path] + ).then((int code) { expect(code, equals(1)); expect(testLogger.errorText, '[warning] The imported libraries \'a.dart\' and \'b.dart\' cannot have the same name \'test\' (${dartFileB.path})\n'); expect(testLogger.statusText, 'Analyzing 2 entry points...\n');
diff --git a/packages/flutter_tools/test/daemon_test.dart b/packages/flutter_tools/test/daemon_test.dart index 793f0b9..23032e3 100644 --- a/packages/flutter_tools/test/daemon_test.dart +++ b/packages/flutter_tools/test/daemon_test.dart
@@ -88,7 +88,7 @@ (Map<String, dynamic> result) => responses.add(result), notifyingLogger: notifyingLogger ); - commands.add({'id': 0, 'method': 'daemon.shutdown'}); + commands.add(<String, dynamic>{'id': 0, 'method': 'daemon.shutdown'}); return daemon.onExit.then((int code) { expect(code, 0); }); @@ -121,7 +121,7 @@ (Map<String, dynamic> result) => responses.add(result), notifyingLogger: notifyingLogger ); - commands.add({'id': 0, 'method': 'device.getDevices'}); + commands.add(<String, dynamic>{'id': 0, 'method': 'device.getDevices'}); Map<String, dynamic> response = await responses.stream.where(_notEvent).first; expect(response['id'], 0); expect(response['result'], isList);
diff --git a/packages/flutter_tools/test/devices.test.dart b/packages/flutter_tools/test/devices.test.dart index 49660c7..cb2239f 100644 --- a/packages/flutter_tools/test/devices.test.dart +++ b/packages/flutter_tools/test/devices.test.dart
@@ -14,14 +14,14 @@ group('devices', () { testUsingContext('returns 0 when called', () { DevicesCommand command = new DevicesCommand(); - return createTestCommandRunner(command).run(['list']).then((int code) { + return createTestCommandRunner(command).run(<String>['list']).then((int code) { expect(code, equals(0)); }); }); testUsingContext('no error when no connected devices', () { DevicesCommand command = new DevicesCommand(); - return createTestCommandRunner(command).run(['list']).then((int code) { + return createTestCommandRunner(command).run(<String>['list']).then((int code) { expect(code, equals(0)); expect(testLogger.statusText, contains('No connected devices')); });
diff --git a/packages/flutter_tools/test/drive_test.dart b/packages/flutter_tools/test/drive_test.dart index 4f20623c..0f7ac54 100644 --- a/packages/flutter_tools/test/drive_test.dart +++ b/packages/flutter_tools/test/drive_test.dart
@@ -60,7 +60,7 @@ testUsingContext('returns 1 when test file is not found', () { withMockDevice(); - List<String> args = [ + List<String> args = <String>[ 'drive', '--target=/some/app/test/e2e.dart', ]; @@ -84,7 +84,7 @@ await memFs.file(testApp).writeAsString('main() {}'); await memFs.file(testFile).writeAsString('main() {}'); - List<String> args = [ + List<String> args = <String>[ 'drive', '--target=$testApp', ]; @@ -102,7 +102,7 @@ useInMemoryFileSystem(cwd: packageDir); String appFile = '/not/in/my/app.dart'; - List<String> args = [ + List<String> args = <String>[ 'drive', '--target=$appFile', ]; @@ -120,7 +120,7 @@ useInMemoryFileSystem(cwd: packageDir); String appFile = '/my/app/main.dart'; - List<String> args = [ + List<String> args = <String>[ 'drive', '--target=$appFile', ]; @@ -144,7 +144,7 @@ return new Future<int>.value(0); }); testRunner = expectAsync((List<String> testArgs) { - expect(testArgs, [testFile]); + expect(testArgs, <String>[testFile]); return new Future<int>.value(0); }); appStopper = expectAsync((_) { @@ -155,7 +155,7 @@ await memFs.file(testApp).writeAsString('main() {}'); await memFs.file(testFile).writeAsString('main() {}'); - List<String> args = [ + List<String> args = <String>[ 'drive', '--target=$testApp', ]; @@ -186,7 +186,7 @@ await memFs.file(testApp).writeAsString('main() {}'); await memFs.file(testFile).writeAsString('main() {}'); - List<String> args = [ + List<String> args = <String>[ 'drive', '--target=$testApp', ]; @@ -243,7 +243,7 @@ Device emulator = new MockDevice(); when(emulator.name).thenReturn('new-simulator'); when(IOSSimulatorUtils.instance.getAttachedDevices()) - .thenReturn([emulator]); + .thenReturn(<Device>[emulator]); Device device = await findTargetDevice(); expect(device.name, 'new-simulator');
diff --git a/packages/flutter_tools/test/install_test.dart b/packages/flutter_tools/test/install_test.dart index a71207d..2b0d0b6 100644 --- a/packages/flutter_tools/test/install_test.dart +++ b/packages/flutter_tools/test/install_test.dart
@@ -21,7 +21,7 @@ when(device.installApp(any)).thenReturn(true); testDeviceManager.addDevice(device); - return createTestCommandRunner(command).run(['install']).then((int code) { + return createTestCommandRunner(command).run(<String>['install']).then((int code) { expect(code, equals(0)); }); }); @@ -35,7 +35,7 @@ when(device.installApp(any)).thenReturn(true); testDeviceManager.addDevice(device); - return createTestCommandRunner(command).run(['install']).then((int code) { + return createTestCommandRunner(command).run(<String>['install']).then((int code) { expect(code, equals(0)); }); });
diff --git a/packages/flutter_tools/test/listen_test.dart b/packages/flutter_tools/test/listen_test.dart index 56bac43..fd9eeb8 100644 --- a/packages/flutter_tools/test/listen_test.dart +++ b/packages/flutter_tools/test/listen_test.dart
@@ -14,7 +14,7 @@ testUsingContext('returns 1 when no device is connected', () { ListenCommand command = new ListenCommand(singleRun: true); applyMocksToCommand(command); - return createTestCommandRunner(command).run(['listen']).then((int code) { + return createTestCommandRunner(command).run(<String>['listen']).then((int code) { expect(code, equals(1)); }); });
diff --git a/packages/flutter_tools/test/src/context.dart b/packages/flutter_tools/test/src/context.dart index f0ac2f0..2c4705b 100644 --- a/packages/flutter_tools/test/src/context.dart +++ b/packages/flutter_tools/test/src/context.dart
@@ -108,7 +108,7 @@ class MockSimControl extends Mock implements SimControl { MockSimControl() { - when(this.getConnectedDevices()).thenReturn([]); + when(this.getConnectedDevices()).thenReturn(<SimDevice>[]); } }
diff --git a/packages/flutter_tools/test/stop_test.dart b/packages/flutter_tools/test/stop_test.dart index 0e3fc23..7effdde 100644 --- a/packages/flutter_tools/test/stop_test.dart +++ b/packages/flutter_tools/test/stop_test.dart
@@ -20,7 +20,7 @@ MockAndroidDevice device = new MockAndroidDevice(); when(device.stopApp(any)).thenReturn(new Future<bool>.value(true)); testDeviceManager.addDevice(device); - return createTestCommandRunner(command).run(['stop']).then((int code) { + return createTestCommandRunner(command).run(<String>['stop']).then((int code) { expect(code, equals(0)); }); }); @@ -32,7 +32,7 @@ when(device.stopApp(any)).thenReturn(new Future<bool>.value(true)); testDeviceManager.addDevice(device); - return createTestCommandRunner(command).run(['stop']).then((int code) { + return createTestCommandRunner(command).run(<String>['stop']).then((int code) { expect(code, equals(0)); }); });
diff --git a/packages/flutter_tools/test/trace_test.dart b/packages/flutter_tools/test/trace_test.dart index e987067..bb14435 100644 --- a/packages/flutter_tools/test/trace_test.dart +++ b/packages/flutter_tools/test/trace_test.dart
@@ -14,7 +14,7 @@ testUsingContext('returns 1 when no Android device is connected', () { TraceCommand command = new TraceCommand(); applyMocksToCommand(command); - return createTestCommandRunner(command).run(['trace']).then((int code) { + return createTestCommandRunner(command).run(<String>['trace']).then((int code) { expect(code, equals(1)); }); });
diff --git a/packages/flutter_tools/tool/daemon_client.dart b/packages/flutter_tools/tool/daemon_client.dart index 31a937c..f11fc0f 100644 --- a/packages/flutter_tools/tool/daemon_client.dart +++ b/packages/flutter_tools/tool/daemon_client.dart
@@ -16,7 +16,7 @@ // devices: list devices Future<Null> main() async { - daemon = await Process.start('dart', ['bin/flutter_tools.dart', 'daemon']); + daemon = await Process.start('dart', <String>['bin/flutter_tools.dart', 'daemon']); print('daemon process started, pid: ${daemon.pid}'); daemon.stdout @@ -28,15 +28,15 @@ stdout.write('> '); stdin.transform(UTF8.decoder).transform(const LineSplitter()).listen((String line) { if (line == 'version' || line == 'v') { - _send({'method': 'daemon.version'}); + _send(<String, dynamic>{'method': 'daemon.version'}); } else if (line == 'shutdown' || line == 'q') { - _send({'method': 'daemon.shutdown'}); + _send(<String, dynamic>{'method': 'daemon.shutdown'}); } else if (line == 'start') { - _send({'method': 'app.start'}); + _send(<String, dynamic>{'method': 'app.start'}); } else if (line == 'stopAll') { - _send({'method': 'app.stopAll'}); + _send(<String, dynamic>{'method': 'app.stopAll'}); } else if (line == 'devices') { - _send({'method': 'device.getDevices'}); + _send(<String, dynamic>{'method': 'device.getDevices'}); } else { print('command not understood: $line'); }