Unnecessary new (#20138)
* enable lint unnecessary_new
* fix tests
* fix tests
* fix tests
diff --git a/packages/flutter_tools/lib/src/base/build.dart b/packages/flutter_tools/lib/src/base/build.dart
index a463ac3..9f06f76 100644
--- a/packages/flutter_tools/lib/src/base/build.dart
+++ b/packages/flutter_tools/lib/src/base/build.dart
@@ -103,7 +103,7 @@
return 1;
}
- final PackageMap packageMap = new PackageMap(packagesPath);
+ final PackageMap packageMap = PackageMap(packagesPath);
final String packageMapError = packageMap.checkValid();
if (packageMapError != null) {
printError(packageMapError);
@@ -120,7 +120,7 @@
final String ioEntryPoints = artifacts.getArtifactPath(Artifact.dartIoEntriesTxt, platform, buildMode);
final List<String> inputPaths = <String>[uiPath, vmServicePath, vmEntryPoints, ioEntryPoints, mainPath];
- final Set<String> outputPaths = new Set<String>();
+ final Set<String> outputPaths = Set<String>();
final String depfilePath = fs.path.join(outputDir.path, 'snapshot.d');
final List<String> genSnapshotArgs = <String>[
@@ -181,7 +181,7 @@
}
// If inputs and outputs have not changed since last run, skip the build.
- final Fingerprinter fingerprinter = new Fingerprinter(
+ final Fingerprinter fingerprinter = Fingerprinter(
fingerprintPath: '$depfilePath.fingerprint',
paths: <String>[mainPath]..addAll(inputPaths)..addAll(outputPaths),
properties: <String, String>{
@@ -198,7 +198,7 @@
return 0;
}
- final SnapshotType snapshotType = new SnapshotType(platform, buildMode);
+ final SnapshotType snapshotType = SnapshotType(platform, buildMode);
final int genSnapshotExitCode = await genSnapshot.run(
snapshotType: snapshotType,
packagesPath: packageMap.packagesPath,
@@ -369,7 +369,7 @@
outputDir.createSync(recursive: true);
final List<String> inputPaths = <String>[mainPath, compilationTraceFilePath];
- final Set<String> outputPaths = new Set<String>();
+ final Set<String> outputPaths = Set<String>();
final String depfilePath = fs.path.join(outputDir.path, 'snapshot.d');
final List<String> genSnapshotArgs = <String>[
@@ -419,7 +419,7 @@
}
// If inputs and outputs have not changed since last run, skip the build.
- final Fingerprinter fingerprinter = new Fingerprinter(
+ final Fingerprinter fingerprinter = Fingerprinter(
fingerprintPath: '$depfilePath.fingerprint',
paths: <String>[mainPath]..addAll(inputPaths)..addAll(outputPaths),
properties: <String, String>{
@@ -435,7 +435,7 @@
return 0;
}
- final SnapshotType snapshotType = new SnapshotType(platform, buildMode);
+ final SnapshotType snapshotType = SnapshotType(platform, buildMode);
final int genSnapshotExitCode = await genSnapshot.run(
snapshotType: snapshotType,
packagesPath: packagesPath,
diff --git a/packages/flutter_tools/lib/src/base/common.dart b/packages/flutter_tools/lib/src/base/common.dart
index 01c2cba..3130576 100644
--- a/packages/flutter_tools/lib/src/base/common.dart
+++ b/packages/flutter_tools/lib/src/base/common.dart
@@ -23,7 +23,7 @@
/// and no stack trace unless the --verbose option is specified.
/// For example: network errors
void throwToolExit(String message, { int exitCode }) {
- throw new ToolExit(message, exitCode: exitCode);
+ throw ToolExit(message, exitCode: exitCode);
}
/// Specialized exception for expected situations
diff --git a/packages/flutter_tools/lib/src/base/context.dart b/packages/flutter_tools/lib/src/base/context.dart
index e4a20dd..2f8fca1 100644
--- a/packages/flutter_tools/lib/src/base/context.dart
+++ b/packages/flutter_tools/lib/src/base/context.dart
@@ -61,7 +61,7 @@
List<Type> _reentrantChecks;
/// Bootstrap context.
- static final AppContext _root = new AppContext._(null, 'ROOT');
+ static final AppContext _root = AppContext._(null, 'ROOT');
dynamic _boxNull(dynamic value) => value ?? _BoxedNull.instance;
@@ -90,8 +90,8 @@
final int index = _reentrantChecks.indexOf(type);
if (index >= 0) {
// We're already in the process of trying to generate this type.
- throw new ContextDependencyCycleException._(
- new UnmodifiableListView<Type>(_reentrantChecks.sublist(index)));
+ throw ContextDependencyCycleException._(
+ UnmodifiableListView<Type>(_reentrantChecks.sublist(index)));
}
_reentrantChecks.add(type);
@@ -132,11 +132,11 @@
Map<Type, Generator> overrides,
Map<Type, Generator> fallbacks,
}) async {
- final AppContext child = new AppContext._(
+ final AppContext child = AppContext._(
this,
name,
- new Map<Type, Generator>.unmodifiable(overrides ?? const <Type, Generator>{}),
- new Map<Type, Generator>.unmodifiable(fallbacks ?? const <Type, Generator>{}),
+ Map<Type, Generator>.unmodifiable(overrides ?? const <Type, Generator>{}),
+ Map<Type, Generator>.unmodifiable(fallbacks ?? const <Type, Generator>{}),
);
return await runZoned<Future<V>>(
() async => await body(),
@@ -146,7 +146,7 @@
@override
String toString() {
- final StringBuffer buf = new StringBuffer();
+ final StringBuffer buf = StringBuffer();
String indent = '';
AppContext ctx = this;
while (ctx != null) {
diff --git a/packages/flutter_tools/lib/src/base/file_system.dart b/packages/flutter_tools/lib/src/base/file_system.dart
index b15e041..0aeebed 100644
--- a/packages/flutter_tools/lib/src/base/file_system.dart
+++ b/packages/flutter_tools/lib/src/base/file_system.dart
@@ -33,7 +33,7 @@
/// directory as long as there is no collision with the `"file"` subdirectory.
RecordingFileSystem getRecordingFileSystem(String location) {
final Directory dir = getRecordingSink(location, _kRecordingType);
- final RecordingFileSystem fileSystem = new RecordingFileSystem(
+ final RecordingFileSystem fileSystem = RecordingFileSystem(
delegate: _kLocalFs, destination: dir);
addShutdownHook(() async {
await fileSystem.recording.flush(
@@ -51,7 +51,7 @@
/// [getRecordingFileSystem]), or a [ToolExit] will be thrown.
ReplayFileSystem getReplayFileSystem(String location) {
final Directory dir = getReplaySource(location, _kRecordingType);
- return new ReplayFileSystem(recording: dir);
+ return ReplayFileSystem(recording: dir);
}
/// Create the ancestor directories of a file path if they do not already exist.
@@ -72,7 +72,7 @@
/// Creates `destDir` if needed.
void copyDirectorySync(Directory srcDir, Directory destDir, [void onFileCopied(File srcFile, File destFile)]) {
if (!srcDir.existsSync())
- throw new Exception('Source directory "${srcDir.path}" does not exist, nothing to copy');
+ throw Exception('Source directory "${srcDir.path}" does not exist, nothing to copy');
if (!destDir.existsSync())
destDir.createSync(recursive: true);
@@ -87,7 +87,7 @@
copyDirectorySync(
entity, destDir.fileSystem.directory(newPath));
} else {
- throw new Exception('${entity.path} is neither File nor Directory');
+ throw Exception('${entity.path} is neither File nor Directory');
}
}
}
diff --git a/packages/flutter_tools/lib/src/base/fingerprint.dart b/packages/flutter_tools/lib/src/base/fingerprint.dart
index a87fda3..4d33ba4 100644
--- a/packages/flutter_tools/lib/src/base/fingerprint.dart
+++ b/packages/flutter_tools/lib/src/base/fingerprint.dart
@@ -30,7 +30,7 @@
Iterable<String> depfilePaths = const <String>[],
FingerprintPathFilter pathFilter,
}) : _paths = paths.toList(),
- _properties = new Map<String, String>.from(properties),
+ _properties = Map<String, String>.from(properties),
_depfilePaths = depfilePaths.toList(),
_pathFilter = pathFilter,
assert(fingerprintPath != null),
@@ -46,7 +46,7 @@
Future<Fingerprint> buildFingerprint() async {
final List<String> paths = await _getPaths();
- return new Fingerprint.fromBuildInputs(_properties, paths);
+ return Fingerprint.fromBuildInputs(_properties, paths);
}
Future<bool> doesFingerprintMatch() async {
@@ -62,7 +62,7 @@
if (!paths.every(fs.isFileSync))
return false;
- final Fingerprint oldFingerprint = new Fingerprint.fromJson(await fingerprintFile.readAsString());
+ final Fingerprint oldFingerprint = Fingerprint.fromJson(await fingerprintFile.readAsString());
final Fingerprint newFingerprint = await buildFingerprint();
return oldFingerprint == newFingerprint;
} catch (e) {
@@ -100,7 +100,7 @@
final Iterable<File> files = inputPaths.map(fs.file);
final Iterable<File> missingInputs = files.where((File file) => !file.existsSync());
if (missingInputs.isNotEmpty)
- throw new ArgumentError('Missing input files:\n' + missingInputs.join('\n'));
+ throw ArgumentError('Missing input files:\n' + missingInputs.join('\n'));
_checksums = <String, String>{};
for (File file in files) {
@@ -119,7 +119,7 @@
final String version = content['version'];
if (version != FlutterVersion.instance.frameworkRevision)
- throw new ArgumentError('Incompatible fingerprint version: $version');
+ throw ArgumentError('Incompatible fingerprint version: $version');
_checksums = content['files']?.cast<String,String>() ?? <String, String>{};
_properties = content['properties']?.cast<String,String>() ?? <String, String>{};
}
@@ -158,8 +158,8 @@
String toString() => '{checksums: $_checksums, properties: $_properties}';
}
-final RegExp _separatorExpr = new RegExp(r'([^\\]) ');
-final RegExp _escapeExpr = new RegExp(r'\\(.)');
+final RegExp _separatorExpr = RegExp(r'([^\\]) ');
+final RegExp _escapeExpr = RegExp(r'\\(.)');
/// Parses a VM snapshot dependency file.
///
diff --git a/packages/flutter_tools/lib/src/base/io.dart b/packages/flutter_tools/lib/src/base/io.dart
index be2dcb2..4beb040 100644
--- a/packages/flutter_tools/lib/src/base/io.dart
+++ b/packages/flutter_tools/lib/src/base/io.dart
@@ -97,7 +97,7 @@
@visibleForTesting
void setExitFunctionForTests([ExitFunction exitFunction]) {
_exitFunction = exitFunction ?? (int exitCode) {
- throw new ProcessExit(exitCode, immediate: true);
+ throw ProcessExit(exitCode, immediate: true);
};
}
diff --git a/packages/flutter_tools/lib/src/base/logger.dart b/packages/flutter_tools/lib/src/base/logger.dart
index dcab62c..d71d974 100644
--- a/packages/flutter_tools/lib/src/base/logger.dart
+++ b/packages/flutter_tools/lib/src/base/logger.dart
@@ -108,10 +108,10 @@
}) {
if (_status != null) {
// Ignore nested progresses; return a no-op status object.
- return new Status(onFinish: _clearStatus)..start();
+ return Status(onFinish: _clearStatus)..start();
}
if (terminal.supportsColor) {
- _status = new AnsiStatus(
+ _status = AnsiStatus(
message: message,
expectSlowOperation: expectSlowOperation,
padding: progressIndicatorPadding,
@@ -119,7 +119,7 @@
)..start();
} else {
printStatus(message);
- _status = new Status(onFinish: _clearStatus)..start();
+ _status = Status(onFinish: _clearStatus)..start();
}
return _status;
}
@@ -153,9 +153,9 @@
@override
bool get isVerbose => false;
- final StringBuffer _error = new StringBuffer();
- final StringBuffer _status = new StringBuffer();
- final StringBuffer _trace = new StringBuffer();
+ final StringBuffer _error = StringBuffer();
+ final StringBuffer _status = StringBuffer();
+ final StringBuffer _trace = StringBuffer();
String get errorText => _error.toString();
String get statusText => _status.toString();
@@ -188,7 +188,7 @@
int progressIndicatorPadding = kDefaultStatusPadding,
}) {
printStatus(message);
- return new Status()..start();
+ return Status()..start();
}
/// Clears all buffers.
@@ -207,7 +207,7 @@
final Logger parent;
- Stopwatch stopwatch = new Stopwatch();
+ Stopwatch stopwatch = Stopwatch();
@override
bool get isVerbose => true;
@@ -238,7 +238,7 @@
int progressIndicatorPadding = kDefaultStatusPadding,
}) {
printStatus(message);
- return new Status(onFinish: () {
+ return Status(onFinish: () {
printTrace('$message (completed)');
})..start();
}
@@ -303,8 +303,8 @@
/// terminal is fancy enough), already started.
factory Status.withSpinner({ VoidCallback onFinish }) {
if (terminal.supportsColor)
- return new AnsiSpinner(onFinish: onFinish)..start();
- return new Status(onFinish: onFinish)..start();
+ return AnsiSpinner(onFinish: onFinish)..start();
+ return Status(onFinish: onFinish)..start();
}
final VoidCallback onFinish;
@@ -353,7 +353,7 @@
super.start();
assert(timer == null);
stdout.write(' ');
- timer = new Timer.periodic(const Duration(milliseconds: 100), _callback);
+ timer = Timer.periodic(const Duration(milliseconds: 100), _callback);
_callback(timer);
}
@@ -394,7 +394,7 @@
@override
void start() {
- stopwatch = new Stopwatch()..start();
+ stopwatch = Stopwatch()..start();
stdout.write('${message.padRight(padding)} ');
super.start();
}
diff --git a/packages/flutter_tools/lib/src/base/net.dart b/packages/flutter_tools/lib/src/base/net.dart
index 343898f..1f761f3 100644
--- a/packages/flutter_tools/lib/src/base/net.dart
+++ b/packages/flutter_tools/lib/src/base/net.dart
@@ -23,7 +23,7 @@
if (result != null)
return result;
printStatus('Download failed -- attempting retry $attempts in $duration second${ duration == 1 ? "" : "s"}...');
- await new Future<Null>.delayed(new Duration(seconds: duration));
+ await Future<Null>.delayed(Duration(seconds: duration));
if (duration < 64)
duration *= 2;
}
@@ -35,7 +35,7 @@
if (context[HttpClientFactory] != null) {
httpClient = context[HttpClientFactory]();
} else {
- httpClient = new HttpClient();
+ httpClient = HttpClient();
}
HttpClientRequest request;
try {
@@ -68,7 +68,7 @@
}
printTrace('Received response from server, collecting bytes...');
try {
- final BytesBuilder responseBody = new BytesBuilder(copy: false);
+ final BytesBuilder responseBody = BytesBuilder(copy: false);
await response.forEach(responseBody.add);
return responseBody.takeBytes();
} on IOException catch (error) {
diff --git a/packages/flutter_tools/lib/src/base/os.dart b/packages/flutter_tools/lib/src/base/os.dart
index 1faa3d3..8c3b30d 100644
--- a/packages/flutter_tools/lib/src/base/os.dart
+++ b/packages/flutter_tools/lib/src/base/os.dart
@@ -16,9 +16,9 @@
abstract class OperatingSystemUtils {
factory OperatingSystemUtils() {
if (platform.isWindows) {
- return new _WindowsUtils();
+ return _WindowsUtils();
} else {
- return new _PosixUtils();
+ return _PosixUtils();
}
}
@@ -155,7 +155,7 @@
// This is a no-op.
@override
ProcessResult makeExecutable(File file) {
- return new ProcessResult(0, 0, null, null);
+ return ProcessResult(0, 0, null, null);
}
@override
@@ -172,7 +172,7 @@
@override
void zip(Directory data, File zipFile) {
- final Archive archive = new Archive();
+ final Archive archive = Archive();
for (FileSystemEntity entity in data.listSync(recursive: true)) {
if (entity is! File) {
continue;
@@ -180,21 +180,21 @@
final File file = entity;
final String path = file.fileSystem.path.relative(file.path, from: data.path);
final List<int> bytes = file.readAsBytesSync();
- archive.addFile(new ArchiveFile(path, bytes.length, bytes));
+ archive.addFile(ArchiveFile(path, bytes.length, bytes));
}
- zipFile.writeAsBytesSync(new ZipEncoder().encode(archive), flush: true);
+ zipFile.writeAsBytesSync(ZipEncoder().encode(archive), flush: true);
}
@override
void unzip(File file, Directory targetDirectory) {
- final Archive archive = new ZipDecoder().decodeBytes(file.readAsBytesSync());
+ final Archive archive = ZipDecoder().decodeBytes(file.readAsBytesSync());
_unpackArchive(archive, targetDirectory);
}
@override
bool verifyZip(File zipFile) {
try {
- new ZipDecoder().decodeBytes(zipFile.readAsBytesSync(), verify: true);
+ ZipDecoder().decodeBytes(zipFile.readAsBytesSync(), verify: true);
} on FileSystemException catch (_) {
return false;
} on ArchiveException catch (_) {
@@ -205,8 +205,8 @@
@override
void unpack(File gzippedTarFile, Directory targetDirectory) {
- final Archive archive = new TarDecoder().decodeBytes(
- new GZipDecoder().decodeBytes(gzippedTarFile.readAsBytesSync()),
+ final Archive archive = TarDecoder().decodeBytes(
+ GZipDecoder().decodeBytes(gzippedTarFile.readAsBytesSync()),
);
_unpackArchive(archive, targetDirectory);
}
@@ -214,7 +214,7 @@
@override
bool verifyGzip(File gzipFile) {
try {
- new GZipDecoder().decodeBytes(gzipFile.readAsBytesSync(), verify: true);
+ GZipDecoder().decodeBytes(gzipFile.readAsBytesSync(), verify: true);
} on FileSystemException catch (_) {
return false;
} on ArchiveException catch (_) {
@@ -238,7 +238,7 @@
@override
File makePipe(String path) {
- throw new UnsupportedError('makePipe is not implemented on Windows.');
+ throw UnsupportedError('makePipe is not implemented on Windows.');
}
String _name;
diff --git a/packages/flutter_tools/lib/src/base/platform.dart b/packages/flutter_tools/lib/src/base/platform.dart
index 1a45a08..359cc5f 100644
--- a/packages/flutter_tools/lib/src/base/platform.dart
+++ b/packages/flutter_tools/lib/src/base/platform.dart
@@ -36,7 +36,7 @@
final Directory dir = getReplaySource(location, _kRecordingType);
final File file = _getPlatformManifest(dir);
final String json = await file.readAsString();
- return new FakePlatform.fromJson(json);
+ return FakePlatform.fromJson(json);
}
File _getPlatformManifest(Directory dir) {
diff --git a/packages/flutter_tools/lib/src/base/process.dart b/packages/flutter_tools/lib/src/base/process.dart
index 247e5ce..09c146c 100644
--- a/packages/flutter_tools/lib/src/base/process.dart
+++ b/packages/flutter_tools/lib/src/base/process.dart
@@ -205,7 +205,7 @@
Future<Null> runAndKill(List<String> cmd, Duration timeout) {
final Future<Process> proc = runDetached(cmd);
- return new Future<Null>.delayed(timeout, () async {
+ return Future<Null>.delayed(timeout, () async {
printTrace('Intentionally killing ${cmd[0]}');
processManager.killPid((await proc).pid);
});
@@ -231,7 +231,7 @@
workingDirectory: workingDirectory,
environment: _environment(allowReentrantFlutter, environment),
);
- final RunResult runResults = new RunResult(results, cmd);
+ final RunResult runResults = RunResult(results, cmd);
printTrace(runResults.toString());
return runResults;
}
@@ -379,7 +379,7 @@
@override
String toString() {
- final StringBuffer out = new StringBuffer();
+ final StringBuffer out = StringBuffer();
if (processResult.stdout.isNotEmpty)
out.writeln(processResult.stdout);
if (processResult.stderr.isNotEmpty)
@@ -389,7 +389,7 @@
/// Throws a [ProcessException] with the given `message`.
void throwException(String message) {
- throw new ProcessException(
+ throw ProcessException(
_command.first,
_command.skip(1).toList(),
message,
diff --git a/packages/flutter_tools/lib/src/base/process_manager.dart b/packages/flutter_tools/lib/src/base/process_manager.dart
index 4420e51..cbf8661 100644
--- a/packages/flutter_tools/lib/src/base/process_manager.dart
+++ b/packages/flutter_tools/lib/src/base/process_manager.dart
@@ -28,7 +28,7 @@
RecordingProcessManager getRecordingProcessManager(String location) {
final Directory dir = getRecordingSink(location, _kRecordingType);
const ProcessManager delegate = LocalProcessManager();
- final RecordingProcessManager manager = new RecordingProcessManager(delegate, dir);
+ final RecordingProcessManager manager = RecordingProcessManager(delegate, dir);
addShutdownHook(() async {
await manager.flush(finishRunningProcesses: true);
}, ShutdownStage.SERIALIZE_RECORDING);
diff --git a/packages/flutter_tools/lib/src/base/terminal.dart b/packages/flutter_tools/lib/src/base/terminal.dart
index 2efff21..c6c21b9 100644
--- a/packages/flutter_tools/lib/src/base/terminal.dart
+++ b/packages/flutter_tools/lib/src/base/terminal.dart
@@ -12,7 +12,7 @@
import 'io.dart' as io;
import 'platform.dart';
-final AnsiTerminal _kAnsiTerminal = new AnsiTerminal();
+final AnsiTerminal _kAnsiTerminal = AnsiTerminal();
AnsiTerminal get terminal {
return (context == null || context[AnsiTerminal] == null)
@@ -30,7 +30,7 @@
String bolden(String message) {
if (!supportsColor)
return message;
- final StringBuffer buffer = new StringBuffer();
+ final StringBuffer buffer = StringBuffer();
for (String line in message.split('\n'))
buffer.writeln('$_bold$line$_reset');
final String result = buffer.toString();
@@ -88,7 +88,7 @@
List<String> charactersToDisplay = acceptedCharacters;
if (defaultChoiceIndex != null) {
assert(defaultChoiceIndex >= 0 && defaultChoiceIndex < acceptedCharacters.length);
- charactersToDisplay = new List<String>.from(charactersToDisplay);
+ charactersToDisplay = List<String>.from(charactersToDisplay);
charactersToDisplay[defaultChoiceIndex] = bolden(charactersToDisplay[defaultChoiceIndex]);
acceptedCharacters.add('\n');
}
diff --git a/packages/flutter_tools/lib/src/base/utils.dart b/packages/flutter_tools/lib/src/base/utils.dart
index 6756c71..8b22e86 100644
--- a/packages/flutter_tools/lib/src/base/utils.dart
+++ b/packages/flutter_tools/lib/src/base/utils.dart
@@ -53,7 +53,7 @@
}
String hex(List<int> bytes) {
- final StringBuffer result = new StringBuffer();
+ final StringBuffer result = StringBuffer();
for (int part in bytes)
result.write('${part < 16 ? '0' : ''}${part.toRadixString(16)}');
return result.toString();
@@ -75,7 +75,7 @@
return str;
}
-final RegExp _upperRegex = new RegExp(r'[A-Z]');
+final RegExp _upperRegex = RegExp(r'[A-Z]');
/// Convert `fooBar` to `foo_bar`.
String snakeCase(String str, [String sep = '_']) {
@@ -121,8 +121,8 @@
return '${(bytesLength / (1024 * 1024)).toStringAsFixed(1)}MB';
}
-final NumberFormat kSecondsFormat = new NumberFormat('0.0');
-final NumberFormat kMillisecondsFormat = new NumberFormat.decimalPattern();
+final NumberFormat kSecondsFormat = NumberFormat('0.0');
+final NumberFormat kMillisecondsFormat = NumberFormat.decimalPattern();
String getElapsedAsSeconds(Duration duration) {
final double seconds = duration.inMilliseconds / Duration.millisecondsPerSecond;
@@ -145,17 +145,17 @@
/// available.
class ItemListNotifier<T> {
ItemListNotifier() {
- _items = new Set<T>();
+ _items = Set<T>();
}
ItemListNotifier.from(List<T> items) {
- _items = new Set<T>.from(items);
+ _items = Set<T>.from(items);
}
Set<T> _items;
- final StreamController<T> _addedController = new StreamController<T>.broadcast();
- final StreamController<T> _removedController = new StreamController<T>.broadcast();
+ final StreamController<T> _addedController = StreamController<T>.broadcast();
+ final StreamController<T> _removedController = StreamController<T>.broadcast();
Stream<T> get onAdded => _addedController.stream;
Stream<T> get onRemoved => _removedController.stream;
@@ -163,7 +163,7 @@
List<T> get items => _items.toList();
void updateWithNewList(List<T> updatedList) {
- final Set<T> updatedSet = new Set<T>.from(updatedList);
+ final Set<T> updatedSet = Set<T>.from(updatedList);
final Set<T> addedItems = updatedSet.difference(_items);
final Set<T> removedItems = _items.difference(updatedSet);
@@ -196,7 +196,7 @@
}
factory SettingsFile.parseFromFile(File file) {
- return new SettingsFile.parse(file.readAsStringSync());
+ return SettingsFile.parse(file.readAsStringSync());
}
final Map<String, String> values = <String, String>{};
@@ -217,7 +217,7 @@
/// For more information, see
/// http://en.wikipedia.org/wiki/Universally_unique_identifier.
class Uuid {
- final Random _random = new Random();
+ final Random _random = Random();
/// Generate a version 4 (random) UUID. This is a UUID scheme that only uses
/// random numbers as the source of the generated UUID.
@@ -258,7 +258,7 @@
/// - waits for a callback to be complete before it starts the next timer
class Poller {
Poller(this.callback, this.pollingInterval, { this.initialDelay = Duration.zero }) {
- new Future<Null>.delayed(initialDelay, _handleCallback);
+ Future<Null>.delayed(initialDelay, _handleCallback);
}
final AsyncCallback callback;
@@ -279,7 +279,7 @@
}
if (!_cancelled)
- _timer = new Timer(pollingInterval, _handleCallback);
+ _timer = Timer(pollingInterval, _handleCallback);
}
/// Cancels the poller.
diff --git a/packages/flutter_tools/lib/src/base/version.dart b/packages/flutter_tools/lib/src/base/version.dart
index 02aa239..663c43e 100644
--- a/packages/flutter_tools/lib/src/base/version.dart
+++ b/packages/flutter_tools/lib/src/base/version.dart
@@ -4,7 +4,7 @@
class Version implements Comparable<Version> {
static final RegExp versionPattern =
- new RegExp(r'^(\d+)(\.(\d+)(\.(\d+))?)?');
+ RegExp(r'^(\d+)(\.(\d+)(\.(\d+))?)?');
/// The major version number: "1" in "1.2.3".
final int major;
@@ -31,16 +31,16 @@
text = '$text.$patch';
}
- return new Version._(major ?? 0, minor ?? 0, patch ?? 0, text);
+ return Version._(major ?? 0, minor ?? 0, patch ?? 0, text);
}
Version._(this.major, this.minor, this.patch, this._text) {
if (major < 0)
- throw new ArgumentError('Major version must be non-negative.');
+ throw ArgumentError('Major version must be non-negative.');
if (minor < 0)
- throw new ArgumentError('Minor version must be non-negative.');
+ throw ArgumentError('Minor version must be non-negative.');
if (patch < 0)
- throw new ArgumentError('Patch version must be non-negative.');
+ throw ArgumentError('Patch version must be non-negative.');
}
/// Creates a new [Version] by parsing [text].
@@ -54,7 +54,7 @@
final int major = int.parse(match[1] ?? '0');
final int minor = int.parse(match[3] ?? '0');
final int patch = int.parse(match[5] ?? '0');
- return new Version._(major, minor, patch, text);
+ return Version._(major, minor, patch, text);
} on FormatException {
return null;
}
@@ -74,7 +74,7 @@
}
- static Version get unknown => new Version(0, 0, 0, text: 'unknown');
+ static Version get unknown => Version(0, 0, 0, text: 'unknown');
/// Two [Version]s are equal if their version numbers are. The version text
/// is ignored.