Unnecessary new (#20138) * enable lint unnecessary_new * fix tests * fix tests * fix tests
diff --git a/packages/flutter_tools/test/devfs_test.dart b/packages/flutter_tools/test/devfs_test.dart index 52ade17..c834d02 100644 --- a/packages/flutter_tools/test/devfs_test.dart +++ b/packages/flutter_tools/test/devfs_test.dart
@@ -29,14 +29,14 @@ final AssetBundle assetBundle = AssetBundleFactory.defaultInstance.createBundle(); setUpAll(() { - fs = new MemoryFileSystem(); + fs = MemoryFileSystem(); filePath = fs.path.join('lib', 'foo.txt'); filePath2 = fs.path.join('foo', 'bar.txt'); }); group('DevFSContent', () { test('bytes', () { - final DevFSByteContent content = new DevFSByteContent(<int>[4, 5, 6]); + final DevFSByteContent content = DevFSByteContent(<int>[4, 5, 6]); expect(content.bytes, orderedEquals(<int>[4, 5, 6])); expect(content.isModified, isTrue); expect(content.isModified, isFalse); @@ -46,7 +46,7 @@ expect(content.isModified, isFalse); }); test('string', () { - final DevFSStringContent content = new DevFSStringContent('some string'); + final DevFSStringContent content = DevFSStringContent('some string'); expect(content.string, 'some string'); expect(content.bytes, orderedEquals(utf8.encode('some string'))); expect(content.isModified, isTrue); @@ -65,8 +65,8 @@ }); group('devfs local', () { - final MockDevFSOperations devFSOperations = new MockDevFSOperations(); - final MockResidentCompiler residentCompiler = new MockResidentCompiler(); + final MockDevFSOperations devFSOperations = MockDevFSOperations(); + final MockResidentCompiler residentCompiler = MockResidentCompiler(); setUpAll(() { tempDir = _newTempDir(fs); @@ -84,7 +84,7 @@ // simulate package await _createPackage(fs, 'somepkg', 'somefile.txt'); - devFS = new DevFS.operations(devFSOperations, 'test', tempDir); + devFS = DevFS.operations(devFSOperations, 'test', tempDir); await devFS.create(); devFSOperations.expectMessages(<String>['create test']); expect(devFS.assetPathsToEvict, isEmpty); @@ -136,7 +136,7 @@ final File file = fs.file(fs.path.join(basePath, filePath)); // Set the last modified time to 5 seconds in the past. - updateFileModificationTime(file.path, new DateTime.now(), -5); + updateFileModificationTime(file.path, DateTime.now(), -5); bytes = await devFS.update( mainPath: 'lib/foo.txt', generator: residentCompiler, @@ -201,7 +201,7 @@ const String packageName = 'doubleslashpkg'; await _createPackage(fs, packageName, 'somefile.txt', doubleSlash: true); - final Set<String> fileFilter = new Set<String>(); + final Set<String> fileFilter = Set<String>(); final List<Uri> pkgUris = <Uri>[fs.path.toUri(basePath)]..addAll(_packages.values); for (Uri pkgUri in pkgUris) { if (!pkgUri.isAbsolute) { @@ -229,7 +229,7 @@ }); testUsingContext('add an asset bundle', () async { - assetBundle.entries['a.txt'] = new DevFSStringContent('abc'); + assetBundle.entries['a.txt'] = DevFSStringContent('abc'); final int bytes = await devFS.update( mainPath: 'lib/foo.txt', bundle: assetBundle, @@ -249,7 +249,7 @@ }); testUsingContext('add a file to the asset bundle - bundleDirty', () async { - assetBundle.entries['b.txt'] = new DevFSStringContent('abcd'); + assetBundle.entries['b.txt'] = DevFSStringContent('abcd'); final int bytes = await devFS.update( mainPath: 'lib/foo.txt', bundle: assetBundle, @@ -272,7 +272,7 @@ }); testUsingContext('add a file to the asset bundle', () async { - assetBundle.entries['c.txt'] = new DevFSStringContent('12'); + assetBundle.entries['c.txt'] = DevFSStringContent('12'); final int bytes = await devFS.update( mainPath: 'lib/foo.txt', bundle: assetBundle, @@ -344,12 +344,12 @@ group('devfs remote', () { MockVMService vmService; - final MockResidentCompiler residentCompiler = new MockResidentCompiler(); + final MockResidentCompiler residentCompiler = MockResidentCompiler(); setUpAll(() async { tempDir = _newTempDir(fs); basePath = tempDir.path; - vmService = new MockVMService(); + vmService = MockVMService(); await vmService.setUp(); }); tearDownAll(() async { @@ -366,7 +366,7 @@ // simulate package await _createPackage(fs, 'somepkg', 'somefile.txt'); - devFS = new DevFS(vmService, 'test', tempDir); + devFS = DevFS(vmService, 'test', tempDir); await devFS.create(); vmService.expectMessages(<String>['create test']); expect(devFS.assetPathsToEvict, isEmpty); @@ -403,7 +403,7 @@ // simulate package await _createPackage(fs, 'somepkg', 'somefile.txt'); - devFS = new DevFS(vmService, 'test', tempDir); + devFS = DevFS(vmService, 'test', tempDir); await devFS.create(); vmService.expectMessages(<String>['create test']); expect(devFS.assetPathsToEvict, isEmpty); @@ -429,7 +429,7 @@ MockVM _vm; MockVMService() { - _vm = new MockVM(this); + _vm = MockVM(this); } @override @@ -480,7 +480,7 @@ Future<Map<String, dynamic>> createDevFS(String fsName) async { _service.messages.add('create $fsName'); if (_devFSExists) { - throw new rpc.RpcException(kFileSystemAlreadyExists, 'File system already exists'); + throw rpc.RpcException(kFileSystemAlreadyExists, 'File system already exists'); } _devFSExists = true; return <String, dynamic>{'uri': '$_baseUri'}; @@ -534,7 +534,7 @@ await pkgFile.parent.create(recursive: true); pkgFile.writeAsBytesSync(<int>[11, 12, 13]); _packages[pkgName] = fs.path.toUri(pkgFile.parent.path); - final StringBuffer sb = new StringBuffer(); + final StringBuffer sb = StringBuffer(); _packages.forEach((String pkgName, Uri pkgUri) { sb.writeln('$pkgName:$pkgUri'); });