Use Dart 2 camel case constants (#15360)
diff --git a/packages/flutter_tools/test/asset_bundle_package_fonts_test.dart b/packages/flutter_tools/test/asset_bundle_package_fonts_test.dart index 8c720b5..db8270f 100644 --- a/packages/flutter_tools/test/asset_bundle_package_fonts_test.dart +++ b/packages/flutter_tools/test/asset_bundle_package_fonts_test.dart
@@ -65,7 +65,7 @@ final String entryKey = 'packages/$packageName/$packageFont'; expect(bundle.entries.containsKey(entryKey), true); expect( - UTF8.decode(await bundle.entries[entryKey].contentsAsBytes()), + utf8.decode(await bundle.entries[entryKey].contentsAsBytes()), packageFont, ); } @@ -73,14 +73,14 @@ for (String localFont in localFonts) { expect(bundle.entries.containsKey(localFont), true); expect( - UTF8.decode(await bundle.entries[localFont].contentsAsBytes()), + utf8.decode(await bundle.entries[localFont].contentsAsBytes()), localFont, ); } } expect( - UTF8.decode(await bundle.entries['FontManifest.json'].contentsAsBytes()), + utf8.decode(await bundle.entries['FontManifest.json'].contentsAsBytes()), expectedAssetManifest, ); }
diff --git a/packages/flutter_tools/test/asset_bundle_package_test.dart b/packages/flutter_tools/test/asset_bundle_package_test.dart index af1183c..630a32b 100644 --- a/packages/flutter_tools/test/asset_bundle_package_test.dart +++ b/packages/flutter_tools/test/asset_bundle_package_test.dart
@@ -72,14 +72,14 @@ final String entryKey = 'packages/$packageName/$asset'; expect(bundle.entries.containsKey(entryKey), true); expect( - UTF8.decode(await bundle.entries[entryKey].contentsAsBytes()), + utf8.decode(await bundle.entries[entryKey].contentsAsBytes()), asset, ); } } expect( - UTF8.decode(await bundle.entries['AssetManifest.json'].contentsAsBytes()), + utf8.decode(await bundle.entries['AssetManifest.json'].contentsAsBytes()), expectedAssetManifest, ); } @@ -127,7 +127,7 @@ expect(bundle.entries.length, 2); // LICENSE, AssetManifest const String expectedAssetManifest = '{}'; expect( - UTF8.decode(await bundle.entries['AssetManifest.json'].contentsAsBytes()), + utf8.decode(await bundle.entries['AssetManifest.json'].contentsAsBytes()), expectedAssetManifest, ); }); @@ -147,7 +147,7 @@ expect(bundle.entries.length, 2); // LICENSE, AssetManifest const String expectedAssetManifest = '{}'; expect( - UTF8.decode(await bundle.entries['AssetManifest.json'].contentsAsBytes()), + utf8.decode(await bundle.entries['AssetManifest.json'].contentsAsBytes()), expectedAssetManifest, );
diff --git a/packages/flutter_tools/test/asset_bundle_test.dart b/packages/flutter_tools/test/asset_bundle_test.dart index 1f9f053..c8f663c 100644 --- a/packages/flutter_tools/test/asset_bundle_test.dart +++ b/packages/flutter_tools/test/asset_bundle_test.dart
@@ -59,7 +59,7 @@ expect(bundle.entries.length, 1); const String expectedAssetManifest = '{}'; expect( - UTF8.decode(await bundle.entries['AssetManifest.json'].contentsAsBytes()), + utf8.decode(await bundle.entries['AssetManifest.json'].contentsAsBytes()), expectedAssetManifest, ); });
diff --git a/packages/flutter_tools/test/asset_bundle_variant_test.dart b/packages/flutter_tools/test/asset_bundle_variant_test.dart index 207e445..d3c37f4 100644 --- a/packages/flutter_tools/test/asset_bundle_variant_test.dart +++ b/packages/flutter_tools/test/asset_bundle_variant_test.dart
@@ -77,7 +77,7 @@ // The main asset file, /a/b/c/foo, and its variants exist. for (String asset in assets) { expect(bundle.entries.containsKey(asset), true); - expect(UTF8.decode(await bundle.entries[asset].contentsAsBytes()), asset); + expect(utf8.decode(await bundle.entries[asset].contentsAsBytes()), asset); } fs.file('a/b/c/foo').deleteSync(); @@ -89,7 +89,7 @@ expect(bundle.entries.containsKey('a/b/c/foo'), false); for (String asset in assets.skip(1)) { expect(bundle.entries.containsKey(asset), true); - expect(UTF8.decode(await bundle.entries[asset].contentsAsBytes()), asset); + expect(utf8.decode(await bundle.entries[asset].contentsAsBytes()), asset); } });
diff --git a/packages/flutter_tools/test/base/build_test.dart b/packages/flutter_tools/test/base/build_test.dart index 53786ef..1c14819 100644 --- a/packages/flutter_tools/test/base/build_test.dart +++ b/packages/flutter_tools/test/base/build_test.dart
@@ -4,7 +4,7 @@ import 'dart:async'; import 'dart:convert'; -import 'dart:convert' show JSON; +import 'dart:convert' show json; import 'package:file/memory.dart'; import 'package:flutter_tools/src/artifacts.dart'; @@ -95,26 +95,26 @@ await fs.file('b.dart').writeAsString('This is b'); final Fingerprint fingerprint = new Fingerprint.fromBuildInputs(<String, String>{}, <String>['a.dart', 'b.dart']); - final Map<String, dynamic> json = JSON.decode(fingerprint.toJson()); - expect(json['files'], hasLength(2)); - expect(json['files']['a.dart'], '8a21a15fad560b799f6731d436c1b698'); - expect(json['files']['b.dart'], '6f144e08b58cd0925328610fad7ac07c'); + final Map<String, dynamic> jsonObject = json.decode(fingerprint.toJson()); + expect(jsonObject['files'], hasLength(2)); + expect(jsonObject['files']['a.dart'], '8a21a15fad560b799f6731d436c1b698'); + expect(jsonObject['files']['b.dart'], '6f144e08b58cd0925328610fad7ac07c'); }, overrides: <Type, Generator>{ FileSystem: () => fs }); testUsingContext('includes framework version', () { final Fingerprint fingerprint = new Fingerprint.fromBuildInputs(<String, String>{}, <String>[]); - final Map<String, dynamic> json = JSON.decode(fingerprint.toJson()); - expect(json['version'], mockVersion.frameworkRevision); + final Map<String, dynamic> jsonObject = json.decode(fingerprint.toJson()); + expect(jsonObject['version'], mockVersion.frameworkRevision); }, overrides: <Type, Generator>{ FlutterVersion: () => mockVersion }); testUsingContext('includes provided properties', () { final Fingerprint fingerprint = new Fingerprint.fromBuildInputs(<String, String>{'a': 'A', 'b': 'B'}, <String>[]); - final Map<String, dynamic> json = JSON.decode(fingerprint.toJson()); - expect(json['properties'], hasLength(2)); - expect(json['properties']['a'], 'A'); - expect(json['properties']['b'], 'B'); + final Map<String, dynamic> jsonObject = json.decode(fingerprint.toJson()); + expect(jsonObject['properties'], hasLength(2)); + expect(jsonObject['properties']['a'], 'A'); + expect(jsonObject['properties']['b'], 'B'); }, overrides: <Type, Generator>{ FlutterVersion: () => mockVersion }); }); @@ -126,7 +126,7 @@ }); testUsingContext('creates fingerprint from valid JSON', () async { - final String json = JSON.encode(<String, dynamic>{ + final String jsonString = json.encode(<String, dynamic>{ 'version': kVersion, 'properties': <String, String>{ 'buildMode': BuildMode.release.toString(), @@ -138,8 +138,8 @@ 'b.dart': '6f144e08b58cd0925328610fad7ac07c', }, }); - final Fingerprint fingerprint = new Fingerprint.fromJson(json); - final Map<String, dynamic> content = JSON.decode(fingerprint.toJson()); + final Fingerprint fingerprint = new Fingerprint.fromJson(jsonString); + final Map<String, dynamic> content = json.decode(fingerprint.toJson()); expect(content, hasLength(3)); expect(content['version'], mockVersion.frameworkRevision); expect(content['properties'], hasLength(3)); @@ -154,31 +154,31 @@ }); testUsingContext('throws ArgumentError for unknown versions', () async { - final String json = JSON.encode(<String, dynamic>{ + final String jsonString = json.encode(<String, dynamic>{ 'version': 'bad', 'properties':<String, String>{}, 'files':<String, String>{}, }); - expect(() => new Fingerprint.fromJson(json), throwsArgumentError); + expect(() => new Fingerprint.fromJson(jsonString), throwsArgumentError); }, overrides: <Type, Generator>{ FlutterVersion: () => mockVersion, }); testUsingContext('throws ArgumentError if version is not present', () async { - final String json = JSON.encode(<String, dynamic>{ + final String jsonString = json.encode(<String, dynamic>{ 'properties':<String, String>{}, 'files':<String, String>{}, }); - expect(() => new Fingerprint.fromJson(json), throwsArgumentError); + expect(() => new Fingerprint.fromJson(jsonString), throwsArgumentError); }, overrides: <Type, Generator>{ FlutterVersion: () => mockVersion, }); testUsingContext('treats missing properties and files entries as if empty', () async { - final String json = JSON.encode(<String, dynamic>{ + final String jsonString = json.encode(<String, dynamic>{ 'version': kVersion, }); - expect(new Fingerprint.fromJson(json), new Fingerprint.fromBuildInputs(<String, String>{}, <String>[])); + expect(new Fingerprint.fromJson(jsonString), new Fingerprint.fromBuildInputs(<String, String>{}, <String>[])); }, overrides: <Type, Generator>{ FlutterVersion: () => mockVersion, }); @@ -197,7 +197,7 @@ b['properties'] = <String, String>{ 'buildMode': BuildMode.release.toString(), }; - expect(new Fingerprint.fromJson(JSON.encode(a)) == new Fingerprint.fromJson(JSON.encode(b)), isFalse); + expect(new Fingerprint.fromJson(json.encode(a)) == new Fingerprint.fromJson(json.encode(b)), isFalse); }, overrides: <Type, Generator>{ FlutterVersion: () => mockVersion, }); @@ -216,7 +216,7 @@ 'a.dart': '8a21a15fad560b799f6731d436c1b698', 'b.dart': '6f144e08b58cd0925328610fad7ac07d', }; - expect(new Fingerprint.fromJson(JSON.encode(a)) == new Fingerprint.fromJson(JSON.encode(b)), isFalse); + expect(new Fingerprint.fromJson(json.encode(a)) == new Fingerprint.fromJson(json.encode(b)), isFalse); }, overrides: <Type, Generator>{ FlutterVersion: () => mockVersion, }); @@ -235,7 +235,7 @@ 'a.dart': '8a21a15fad560b799f6731d436c1b698', 'c.dart': '6f144e08b58cd0925328610fad7ac07d', }; - expect(new Fingerprint.fromJson(JSON.encode(a)) == new Fingerprint.fromJson(JSON.encode(b)), isFalse); + expect(new Fingerprint.fromJson(json.encode(a)) == new Fingerprint.fromJson(json.encode(b)), isFalse); }, overrides: <Type, Generator>{ FlutterVersion: () => mockVersion, }); @@ -253,7 +253,7 @@ 'b.dart': '6f144e08b58cd0925328610fad7ac07c', }, }; - expect(new Fingerprint.fromJson(JSON.encode(a)) == new Fingerprint.fromJson(JSON.encode(a)), isTrue); + expect(new Fingerprint.fromJson(json.encode(a)) == new Fingerprint.fromJson(json.encode(a)), isTrue); }, overrides: <Type, Generator>{ FlutterVersion: () => mockVersion, }); @@ -344,7 +344,7 @@ }; Future<Null> writeFingerprint({ Map<String, String> files = const <String, String>{} }) { - return fs.file('output.snapshot.d.fingerprint').writeAsString(JSON.encode(<String, dynamic>{ + return fs.file('output.snapshot.d.fingerprint').writeAsString(json.encode(<String, dynamic>{ 'version': kVersion, 'properties': <String, String>{ 'buildMode': BuildMode.debug.toString(), @@ -371,14 +371,14 @@ String entryPoint: 'main.dart', Map<String, String> checksums = const <String, String>{}, }) { - final Map<String, dynamic> json = JSON.decode(fs.file('output.snapshot.d.fingerprint').readAsStringSync()); - expect(json['properties']['entryPoint'], entryPoint); - expect(json['files'], hasLength(checksums.length + 2)); + final Map<String, dynamic> jsonObject = json.decode(fs.file('output.snapshot.d.fingerprint').readAsStringSync()); + expect(jsonObject['properties']['entryPoint'], entryPoint); + expect(jsonObject['files'], hasLength(checksums.length + 2)); checksums.forEach((String path, String checksum) { - expect(json['files'][path], checksum); + expect(jsonObject['files'][path], checksum); }); - expect(json['files'][kVmSnapshotData], '2ec34912477a46c03ddef07e8b909b46'); - expect(json['files'][kIsolateSnapshotData], '621b3844bb7d4d17d2cfc5edf9a91c4c'); + expect(jsonObject['files'][kVmSnapshotData], '2ec34912477a46c03ddef07e8b909b46'); + expect(jsonObject['files'][kIsolateSnapshotData], '621b3844bb7d4d17d2cfc5edf9a91c4c'); } testUsingContext('builds snapshot and fingerprint when no fingerprint is present', () async {
diff --git a/packages/flutter_tools/test/commands/config_test.dart b/packages/flutter_tools/test/commands/config_test.dart index c096e3e..9485201 100644 --- a/packages/flutter_tools/test/commands/config_test.dart +++ b/packages/flutter_tools/test/commands/config_test.dart
@@ -30,14 +30,14 @@ await command.handleMachine(); expect(logger.statusText, isNotEmpty); - final dynamic json = JSON.decode(logger.statusText); - expect(json, isMap); + final dynamic jsonObject = json.decode(logger.statusText); + expect(jsonObject, isMap); - expect(json.containsKey('android-studio-dir'), true); - expect(json['android-studio-dir'], isNotNull); + expect(jsonObject.containsKey('android-studio-dir'), true); + expect(jsonObject['android-studio-dir'], isNotNull); - expect(json.containsKey('android-sdk'), true); - expect(json['android-sdk'], isNotNull); + expect(jsonObject.containsKey('android-sdk'), true); + expect(jsonObject['android-sdk'], isNotNull); }, overrides: <Type, Generator>{ AndroidStudio: () => mockAndroidStudio, AndroidSdk: () => mockAndroidSdk,
diff --git a/packages/flutter_tools/test/commands/create_test.dart b/packages/flutter_tools/test/commands/create_test.dart index a21ec7b..5c1e2d4 100644 --- a/packages/flutter_tools/test/commands/create_test.dart +++ b/packages/flutter_tools/test/commands/create_test.dart
@@ -207,7 +207,7 @@ <String>[file.path], workingDirectory: projectDir.path, ); - final String formatted = await process.stdout.transform(UTF8.decoder).join(); + final String formatted = await process.stdout.transform(utf8.decoder).join(); expect(original, formatted, reason: file.path); }
diff --git a/packages/flutter_tools/test/compile_test.dart b/packages/flutter_tools/test/compile_test.dart index 36f3847..45e0bb9 100644 --- a/packages/flutter_tools/test/compile_test.dart +++ b/packages/flutter_tools/test/compile_test.dart
@@ -41,7 +41,7 @@ final BufferLogger logger = context[Logger]; when(mockFrontendServer.stdout) .thenAnswer((Invocation invocation) => new Stream<List<int>>.fromFuture( - new Future<List<int>>.value(UTF8.encode( + new Future<List<int>>.value(utf8.encode( 'result abc\nline1\nline2\nabc /path/to/main.dart.dill' )) )); @@ -60,7 +60,7 @@ when(mockFrontendServer.stdout) .thenAnswer((Invocation invocation) => new Stream<List<int>>.fromFuture( - new Future<List<int>>.value(UTF8.encode( + new Future<List<int>>.value(utf8.encode( 'result abc\nline1\nline2\nabc' )) )); @@ -82,7 +82,7 @@ when(mockFrontendServer.stdout) .thenAnswer((Invocation invocation) => new Stream<List<int>>.fromFuture( - new Future<List<int>>.value(UTF8.encode( + new Future<List<int>>.value(utf8.encode( 'result abc\nline1\nline2\nabc' )) )); @@ -134,7 +134,7 @@ when(mockFrontendServer.stdout) .thenAnswer((Invocation invocation) => new Stream<List<int>>.fromFuture( - new Future<List<int>>.value(UTF8.encode( + new Future<List<int>>.value(utf8.encode( 'result abc\nline1\nline2\nabc /path/to/main.dart.dill' )) )); @@ -169,7 +169,7 @@ final StreamController<List<int>> streamController = new StreamController<List<int>>(); when(mockFrontendServer.stdout) .thenAnswer((Invocation invocation) => streamController.stream); - streamController.add(UTF8.encode('result abc\nline0\nline1\nabc /path/to/main.dart.dill\n')); + streamController.add(utf8.encode('result abc\nline0\nline1\nabc /path/to/main.dart.dill\n')); await generator.recompile('/path/to/main.dart', null /* invalidatedFiles */); expect(mockFrontendServerStdIn.getAndClear(), 'compile /path/to/main.dart\n'); @@ -192,7 +192,7 @@ final StreamController<List<int>> streamController = new StreamController<List<int>>(); when(mockFrontendServer.stdout) .thenAnswer((Invocation invocation) => streamController.stream); - streamController.add(UTF8.encode( + streamController.add(utf8.encode( 'result abc\nline0\nline1\nabc /path/to/main.dart.dill\n' )); await generator.recompile('/path/to/main.dart', null /* invalidatedFiles */); @@ -222,7 +222,7 @@ // Put content into the output stream after generator.recompile gets // going few lines below, resets completer. new Future<List<int>>(() { - streamController.add(UTF8.encode(mockCompilerOutput)); + streamController.add(utf8.encode(mockCompilerOutput)); }); final String output = await generator.recompile(null /* mainPath */, <String>['/path/to/main.dart']); expect(output, equals('/path/to/main.dart.dill'));
diff --git a/packages/flutter_tools/test/crash_reporting_test.dart b/packages/flutter_tools/test/crash_reporting_test.dart index 2416d25..de3b23d 100644 --- a/packages/flutter_tools/test/crash_reporting_test.dart +++ b/packages/flutter_tools/test/crash_reporting_test.dart
@@ -53,7 +53,7 @@ String boundary = request.headers['Content-Type']; boundary = boundary.substring(boundary.indexOf('boundary=') + 9); fields = new Map<String, String>.fromIterable( - UTF8.decode(request.bodyBytes) + utf8.decode(request.bodyBytes) .split('--$boundary') .map<List<String>>((String part) { final Match nameMatch = new RegExp(r'name="(.*)"').firstMatch(part);
diff --git a/packages/flutter_tools/test/devfs_test.dart b/packages/flutter_tools/test/devfs_test.dart index 6252f45..01eba00 100644 --- a/packages/flutter_tools/test/devfs_test.dart +++ b/packages/flutter_tools/test/devfs_test.dart
@@ -49,17 +49,17 @@ test('string', () { final DevFSStringContent content = new DevFSStringContent('some string'); expect(content.string, 'some string'); - expect(content.bytes, orderedEquals(UTF8.encode('some string'))); + expect(content.bytes, orderedEquals(utf8.encode('some string'))); expect(content.isModified, isTrue); expect(content.isModified, isFalse); content.string = 'another string'; expect(content.string, 'another string'); - expect(content.bytes, orderedEquals(UTF8.encode('another string'))); + expect(content.bytes, orderedEquals(utf8.encode('another string'))); expect(content.isModified, isTrue); expect(content.isModified, isFalse); - content.bytes = UTF8.encode('foo bar'); + content.bytes = utf8.encode('foo bar'); expect(content.string, 'foo bar'); - expect(content.bytes, orderedEquals(UTF8.encode('foo bar'))); + expect(content.bytes, orderedEquals(utf8.encode('foo bar'))); expect(content.isModified, isTrue); expect(content.isModified, isFalse); }); @@ -97,7 +97,7 @@ ]); expect(devFS.assetPathsToEvict, isEmpty); - final List<String> packageSpecOnDevice = LineSplitter.split(UTF8.decode( + final List<String> packageSpecOnDevice = LineSplitter.split(utf8.decode( await devFSOperations.devicePathToContent[fs.path.toUri('.packages')].contentsAsBytes() )).toList(); expect(packageSpecOnDevice, @@ -397,7 +397,7 @@ } _server.listen((HttpRequest request) { final String fsName = request.headers.value('dev_fs_name'); - final String devicePath = UTF8.decode(BASE64.decode(request.headers.value('dev_fs_uri_b64'))); + final String devicePath = utf8.decode(base64.decode(request.headers.value('dev_fs_uri_b64'))); messages.add('writeFile $fsName $devicePath'); request.drain<List<int>>().then<Null>((List<int> value) { request.response
diff --git a/packages/flutter_tools/test/ios/code_signing_test.dart b/packages/flutter_tools/test/ios/code_signing_test.dart index 82e04a9..015eb1d 100644 --- a/packages/flutter_tools/test/ios/code_signing_test.dart +++ b/packages/flutter_tools/test/ios/code_signing_test.dart
@@ -125,7 +125,7 @@ when(mockProcess.stdin).thenReturn(mockStdIn); when(mockProcess.stdout) .thenAnswer((Invocation invocation) => new Stream<List<int>>.fromFuture( - new Future<List<int>>.value(UTF8.encode( + new Future<List<int>>.value(utf8.encode( 'subject= /CN=iPhone Developer: Profile 1 (1111AAAA11)/OU=3333CCCC33/O=My Team/C=US' )) )); @@ -184,7 +184,7 @@ when(mockOpenSslProcess.stdin).thenReturn(mockOpenSslStdIn); when(mockOpenSslProcess.stdout) .thenAnswer((Invocation invocation) => new Stream<List<int>>.fromFuture( - new Future<List<int>>.value(UTF8.encode( + new Future<List<int>>.value(utf8.encode( 'subject= /CN=iPhone Developer: Profile 3 (3333CCCC33)/OU=4444DDDD44/O=My Team/C=US' )) )); @@ -254,7 +254,7 @@ when(mockOpenSslProcess.stdin).thenReturn(mockOpenSslStdIn); when(mockOpenSslProcess.stdout) .thenAnswer((Invocation invocation) => new Stream<List<int>>.fromFuture( - new Future<List<int>>.value(UTF8.encode( + new Future<List<int>>.value(utf8.encode( 'subject= /CN=iPhone Developer: Profile 1 (1111AAAA11)/OU=5555EEEE55/O=My Team/C=US' )), )); @@ -316,7 +316,7 @@ when(mockOpenSslProcess.stdin).thenReturn(mockOpenSslStdIn); when(mockOpenSslProcess.stdout) .thenAnswer((Invocation invocation) => new Stream<List<int>>.fromFuture( - new Future<List<int>>.value(UTF8.encode( + new Future<List<int>>.value(utf8.encode( 'subject= /CN=iPhone Developer: Profile 3 (3333CCCC33)/OU=4444DDDD44/O=My Team/C=US' )) )); @@ -385,7 +385,7 @@ when(mockOpenSslProcess.stdin).thenReturn(mockOpenSslStdIn); when(mockOpenSslProcess.stdout) .thenAnswer((Invocation invocation) => new Stream<List<int>>.fromFuture( - new Future<List<int>>.value(UTF8.encode( + new Future<List<int>>.value(utf8.encode( 'subject= /CN=iPhone Developer: Profile 3 (3333CCCC33)/OU=4444DDDD44/O=My Team/C=US' )) ));
diff --git a/packages/flutter_tools/test/ios/devices_test.dart b/packages/flutter_tools/test/ios/devices_test.dart index 60e9914..099e7afd 100644 --- a/packages/flutter_tools/test/ios/devices_test.dart +++ b/packages/flutter_tools/test/ios/devices_test.dart
@@ -107,7 +107,7 @@ .thenAnswer((Invocation invocation) => const Stream<List<int>>.empty()); // Delay return of exitCode until after stdout stream data, since it terminates the logger. when(mockProcess.exitCode) - .thenAnswer((Invocation invocation) => new Future<int>.delayed(Duration.ZERO, () => 0)); + .thenAnswer((Invocation invocation) => new Future<int>.delayed(Duration.zero, () => 0)); return new Future<Process>.value(mockProcess); });
diff --git a/packages/flutter_tools/test/ios/simulators_test.dart b/packages/flutter_tools/test/ios/simulators_test.dart index 9ef1cf4..d717f96 100644 --- a/packages/flutter_tools/test/ios/simulators_test.dart +++ b/packages/flutter_tools/test/ios/simulators_test.dart
@@ -289,7 +289,7 @@ .thenAnswer((Invocation invocation) => const Stream<List<int>>.empty()); // Delay return of exitCode until after stdout stream data, since it terminates the logger. when(mockProcess.exitCode) - .thenAnswer((Invocation invocation) => new Future<int>.delayed(Duration.ZERO, () => 0)); + .thenAnswer((Invocation invocation) => new Future<int>.delayed(Duration.zero, () => 0)); return new Future<Process>.value(mockProcess); }) .thenThrow(new TestFailure('Should start one process only'));
diff --git a/packages/flutter_tools/test/src/mocks.dart b/packages/flutter_tools/test/src/mocks.dart index 6c29a5e..d7e4a1c 100644 --- a/packages/flutter_tools/test/src/mocks.dart +++ b/packages/flutter_tools/test/src/mocks.dart
@@ -169,13 +169,13 @@ /// some lines to stdout before it exits. class PromptingProcess implements Process { Future<Null> showPrompt(String prompt, List<String> outputLines) async { - _stdoutController.add(UTF8.encode(prompt)); + _stdoutController.add(utf8.encode(prompt)); final List<int> bytesOnStdin = await _stdin.future; // Echo stdin to stdout. _stdoutController.add(bytesOnStdin); - if (bytesOnStdin[0] == UTF8.encode('y')[0]) { + if (bytesOnStdin[0] == utf8.encode('y')[0]) { for (final String line in outputLines) - _stdoutController.add(UTF8.encode('$line\n')); + _stdoutController.add(utf8.encode('$line\n')); } await _stdoutController.close(); } @@ -219,7 +219,7 @@ /// An IOSink that collects whatever is written to it. class MemoryIOSink implements IOSink { @override - Encoding encoding = UTF8; + Encoding encoding = utf8; final List<List<int>> writes = <List<int>>[]; @@ -291,7 +291,7 @@ Stream<List<int>> get stdin => _stdin.stream; void simulateStdin(String line) { - _stdin.add(UTF8.encode('$line\n')); + _stdin.add(utf8.encode('$line\n')); } List<String> get writtenToStdout => _stdout.writes.map(_stdout.encoding.decode).toList();
diff --git a/packages/flutter_tools/test/version_test.dart b/packages/flutter_tools/test/version_test.dart index 331151d..4e53722 100644 --- a/packages/flutter_tools/test/version_test.dart +++ b/packages/flutter_tools/test/version_test.dart
@@ -30,7 +30,7 @@ setUpAll(() { Cache.disableLocking(); - FlutterVersion.kPauseToLetUserReadTheMessage = Duration.ZERO; + FlutterVersion.kPauseToLetUserReadTheMessage = Duration.zero; }); setUp(() { @@ -300,7 +300,7 @@ return stampJson; if (stamp != null) - return JSON.encode(stamp.toJson()); + return json.encode(stamp.toJson()); return null; }); @@ -309,7 +309,7 @@ expect(invocation.positionalArguments.first, VersionCheckStamp.kFlutterVersionCheckStampFile); if (expectSetStamp) { - stamp = VersionCheckStamp.fromJson(JSON.decode(invocation.positionalArguments[1])); + stamp = VersionCheckStamp.fromJson(json.decode(invocation.positionalArguments[1])); return null; }