Unnecessary new (#20138)
* enable lint unnecessary_new
* fix tests
* fix tests
* fix tests
diff --git a/packages/flutter_tools/lib/src/android/adb.dart b/packages/flutter_tools/lib/src/android/adb.dart
index 942dbd8..4a3fc36 100644
--- a/packages/flutter_tools/lib/src/android/adb.dart
+++ b/packages/flutter_tools/lib/src/android/adb.dart
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-final RegExp _whitespaceRegex = new RegExp(r'\s+');
+final RegExp _whitespaceRegex = RegExp(r'\s+');
String cleanAdbDeviceName(String name) {
// Some emulators use `___` in the name as separators.
diff --git a/packages/flutter_tools/lib/src/android/android_device.dart b/packages/flutter_tools/lib/src/android/android_device.dart
index fec83df..582283c 100644
--- a/packages/flutter_tools/lib/src/android/android_device.dart
+++ b/packages/flutter_tools/lib/src/android/android_device.dart
@@ -162,7 +162,7 @@
bool _isValidAdbVersion(String adbVersion) {
// Sample output: 'Android Debug Bridge version 1.0.31'
- final Match versionFields = new RegExp(r'(\d+)\.(\d+)\.(\d+)').firstMatch(adbVersion);
+ final Match versionFields = RegExp(r'(\d+)\.(\d+)\.(\d+)').firstMatch(adbVersion);
if (versionFields != null) {
final int majorVersion = int.parse(versionFields[1]);
final int minorVersion = int.parse(versionFields[2]);
@@ -283,7 +283,7 @@
status.stop();
// Some versions of adb exit with exit code 0 even on failure :(
// Parsing the output to check for failures.
- final RegExp failureExp = new RegExp(r'^Failure.*$', multiLine: true);
+ final RegExp failureExp = RegExp(r'^Failure.*$', multiLine: true);
final String failure = failureExp.stringMatch(installResult.stdout);
if (failure != null) {
printError('Package install error: $failure');
@@ -307,7 +307,7 @@
return false;
final String uninstallOut = (await runCheckedAsync(adbCommandForDevice(<String>['uninstall', app.id]))).stdout;
- final RegExp failureExp = new RegExp(r'^Failure.*$', multiLine: true);
+ final RegExp failureExp = RegExp(r'^Failure.*$', multiLine: true);
final String failure = failureExp.stringMatch(uninstallOut);
if (failure != null) {
printError('Package uninstall error: $failure');
@@ -358,14 +358,14 @@
bool ipv6 = false,
}) async {
if (!await _checkForSupportedAdbVersion() || !await _checkForSupportedAndroidVersion())
- return new LaunchResult.failed();
+ return LaunchResult.failed();
final TargetPlatform devicePlatform = await targetPlatform;
if (!(devicePlatform == TargetPlatform.android_arm ||
devicePlatform == TargetPlatform.android_arm64) &&
!debuggingOptions.buildInfo.isDebug) {
printError('Profile and release builds are only supported on ARM targets.');
- return new LaunchResult.failed();
+ return LaunchResult.failed();
}
BuildInfo buildInfo = debuggingOptions.buildInfo;
@@ -389,7 +389,7 @@
await stopApp(package);
if (!await _installLatestApp(package))
- return new LaunchResult.failed();
+ return LaunchResult.failed();
final bool traceStartup = platformArgs['trace-startup'] ?? false;
final AndroidApk apk = package;
@@ -400,7 +400,7 @@
if (debuggingOptions.debuggingEnabled) {
// TODO(devoncarew): Remember the forwarding information (so we can later remove the
// port forwarding or set it up again when adb fails on us).
- observatoryDiscovery = new ProtocolDiscovery.observatory(
+ observatoryDiscovery = ProtocolDiscovery.observatory(
getLogReader(),
portForwarder: portForwarder,
hostPort: debuggingOptions.observatoryPort,
@@ -441,11 +441,11 @@
// This invocation returns 0 even when it fails.
if (result.contains('Error: ')) {
printError(result.trim());
- return new LaunchResult.failed();
+ return LaunchResult.failed();
}
if (!debuggingOptions.debuggingEnabled)
- return new LaunchResult.succeeded();
+ return LaunchResult.succeeded();
// Wait for the service protocol port here. This will complete once the
// device has printed "Observatory is listening on...".
@@ -459,10 +459,10 @@
observatoryUri = await observatoryDiscovery.uri;
}
- return new LaunchResult.succeeded(observatoryUri: observatoryUri);
+ return LaunchResult.succeeded(observatoryUri: observatoryUri);
} catch (error) {
printError('Error waiting for a debug connection: $error');
- return new LaunchResult.failed();
+ return LaunchResult.failed();
} finally {
await observatoryDiscovery.cancel();
}
@@ -485,14 +485,14 @@
@override
DeviceLogReader getLogReader({ApplicationPackage app}) {
// The Android log reader isn't app-specific.
- _logReader ??= new _AdbLogReader(this);
+ _logReader ??= _AdbLogReader(this);
return _logReader;
}
@override
- DevicePortForwarder get portForwarder => _portForwarder ??= new _AndroidDevicePortForwarder(this);
+ DevicePortForwarder get portForwarder => _portForwarder ??= _AndroidDevicePortForwarder(this);
- static final RegExp _timeRegExp = new RegExp(r'^\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{3}', multiLine: true);
+ static final RegExp _timeRegExp = RegExp(r'^\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{3}', multiLine: true);
/// Return the most recent timestamp in the Android log or null if there is
/// no available timestamp. The format can be passed to logcat's -T option.
@@ -522,7 +522,7 @@
Map<String, String> parseAdbDeviceProperties(String str) {
final Map<String, String> properties = <String, String>{};
- final RegExp propertyExp = new RegExp(r'\[(.*?)\]: \[(.*?)\]');
+ final RegExp propertyExp = RegExp(r'\[(.*?)\]: \[(.*?)\]');
for (Match match in propertyExp.allMatches(str))
properties[match.group(1)] = match.group(2);
return properties;
@@ -557,7 +557,7 @@
}
// 015d172c98400a03 device usb:340787200X product:nakasi model:Nexus_7 device:grouper
-final RegExp _kDeviceRegex = new RegExp(r'^(\S+)\s+(\S+)(.*)');
+final RegExp _kDeviceRegex = RegExp(r'^(\S+)\s+(\S+)(.*)');
/// Parse the given `adb devices` output in [text], and fill out the given list
/// of devices and possible device issue diagnostics. Either argument can be null,
@@ -579,7 +579,7 @@
continue;
// Skip lines about adb server and client version not matching
- if (line.startsWith(new RegExp(r'adb server (version|is out of date)'))) {
+ if (line.startsWith(RegExp(r'adb server (version|is out of date)'))) {
diagnostics?.add(line);
continue;
}
@@ -616,7 +616,7 @@
} else if (deviceState == 'offline') {
diagnostics?.add('Device $deviceID is offline.');
} else {
- devices?.add(new AndroidDevice(
+ devices?.add(AndroidDevice(
deviceID,
productID: info['product'],
modelID: info['model'] ?? deviceID,
@@ -635,7 +635,7 @@
/// A log reader that logs from `adb logcat`.
class _AdbLogReader extends DeviceLogReader {
_AdbLogReader(this.device) {
- _linesController = new StreamController<String>.broadcast(
+ _linesController = StreamController<String>.broadcast(
onListen: _start,
onCancel: _stop
);
@@ -659,7 +659,7 @@
// Dart's DateTime parse function accepts this format so long as we provide
// the year, resulting in:
// yyyy-mm-dd hours:minutes:seconds.milliseconds.
- return DateTime.parse('${new DateTime.now().year}-$adbTimestamp');
+ return DateTime.parse('${DateTime.now().year}-$adbTimestamp');
}
void _start() {
@@ -683,25 +683,25 @@
}
// 'W/ActivityManager(pid): '
- static final RegExp _logFormat = new RegExp(r'^[VDIWEF]\/.*?\(\s*(\d+)\):\s');
+ static final RegExp _logFormat = RegExp(r'^[VDIWEF]\/.*?\(\s*(\d+)\):\s');
static final List<RegExp> _whitelistedTags = <RegExp>[
- new RegExp(r'^[VDIWEF]\/flutter[^:]*:\s+', caseSensitive: false),
- new RegExp(r'^[IE]\/DartVM[^:]*:\s+'),
- new RegExp(r'^[WEF]\/AndroidRuntime:\s+'),
- new RegExp(r'^[WEF]\/ActivityManager:\s+.*(\bflutter\b|\bdomokit\b|\bsky\b)'),
- new RegExp(r'^[WEF]\/System\.err:\s+'),
- new RegExp(r'^[F]\/[\S^:]+:\s+')
+ RegExp(r'^[VDIWEF]\/flutter[^:]*:\s+', caseSensitive: false),
+ RegExp(r'^[IE]\/DartVM[^:]*:\s+'),
+ RegExp(r'^[WEF]\/AndroidRuntime:\s+'),
+ RegExp(r'^[WEF]\/ActivityManager:\s+.*(\bflutter\b|\bdomokit\b|\bsky\b)'),
+ RegExp(r'^[WEF]\/System\.err:\s+'),
+ RegExp(r'^[F]\/[\S^:]+:\s+')
];
// 'F/libc(pid): Fatal signal 11'
- static final RegExp _fatalLog = new RegExp(r'^F\/libc\s*\(\s*\d+\):\sFatal signal (\d+)');
+ static final RegExp _fatalLog = RegExp(r'^F\/libc\s*\(\s*\d+\):\sFatal signal (\d+)');
// 'I/DEBUG(pid): ...'
- static final RegExp _tombstoneLine = new RegExp(r'^[IF]\/DEBUG\s*\(\s*\d+\):\s(.+)$');
+ static final RegExp _tombstoneLine = RegExp(r'^[IF]\/DEBUG\s*\(\s*\d+\):\s(.+)$');
// 'I/DEBUG(pid): Tombstone written to: '
- static final RegExp _tombstoneTerminator = new RegExp(r'^Tombstone written to:\s');
+ static final RegExp _tombstoneTerminator = RegExp(r'^Tombstone written to:\s');
// we default to true in case none of the log lines match
bool _acceptedLastLine = true;
@@ -826,7 +826,7 @@
if (hostPort == null || devicePort == null)
continue;
- ports.add(new ForwardedPort(hostPort, devicePort));
+ ports.add(ForwardedPort(hostPort, devicePort));
}
}
diff --git a/packages/flutter_tools/lib/src/android/android_emulator.dart b/packages/flutter_tools/lib/src/android/android_emulator.dart
index 582bf0f..22c32ad 100644
--- a/packages/flutter_tools/lib/src/android/android_emulator.dart
+++ b/packages/flutter_tools/lib/src/android/android_emulator.dart
@@ -56,7 +56,7 @@
// return.
return Future.any<void>(<Future<void>>[
launchResult,
- new Future<void>.delayed(const Duration(seconds: 3))
+ Future<void>.delayed(const Duration(seconds: 3))
]);
}
}
@@ -98,13 +98,13 @@
if (configFile.existsSync()) {
final Map<String, String> properties =
parseIniLines(configFile.readAsLinesSync());
- return new AndroidEmulator(id, properties);
+ return AndroidEmulator(id, properties);
}
}
}
}
- return new AndroidEmulator(id);
+ return AndroidEmulator(id);
}
@visibleForTesting
diff --git a/packages/flutter_tools/lib/src/android/android_sdk.dart b/packages/flutter_tools/lib/src/android/android_sdk.dart
index de20ccb..72344d2 100644
--- a/packages/flutter_tools/lib/src/android/android_sdk.dart
+++ b/packages/flutter_tools/lib/src/android/android_sdk.dart
@@ -36,8 +36,8 @@
// $ANDROID_HOME/platforms/android-23/android.jar
// $ANDROID_HOME/platforms/android-N/android.jar
-final RegExp _numberedAndroidPlatformRe = new RegExp(r'^android-([0-9]+)$');
-final RegExp _sdkVersionRe = new RegExp(r'^ro.build.version.sdk=([0-9]+)$');
+final RegExp _numberedAndroidPlatformRe = RegExp(r'^android-([0-9]+)$');
+final RegExp _sdkVersionRe = RegExp(r'^ro.build.version.sdk=([0-9]+)$');
/// The minimum Android SDK version we support.
const int minimumAndroidSdkVersion = 25;
@@ -127,13 +127,13 @@
/// Locate NDK within the given SDK or throw [AndroidNdkSearchError].
static AndroidNdk locateNdk(String androidHomeDir) {
if (androidHomeDir == null) {
- throw new AndroidNdkSearchError('Can not locate NDK because no SDK is found');
+ throw AndroidNdkSearchError('Can not locate NDK because no SDK is found');
}
String findBundle(String androidHomeDir) {
final String ndkDirectory = fs.path.join(androidHomeDir, 'ndk-bundle');
if (!fs.isDirectorySync(ndkDirectory)) {
- throw new AndroidNdkSearchError('Can not locate ndk-bundle, tried: $ndkDirectory');
+ throw AndroidNdkSearchError('Can not locate ndk-bundle, tried: $ndkDirectory');
}
return ndkDirectory;
}
@@ -145,14 +145,14 @@
} else if (platform.isMacOS) {
directory = 'darwin-x86_64';
} else {
- throw new AndroidNdkSearchError('Only Linux and macOS are supported');
+ throw AndroidNdkSearchError('Only Linux and macOS are supported');
}
final String ndkCompiler = fs.path.join(ndkDirectory,
'toolchains', 'arm-linux-androideabi-4.9', 'prebuilt', directory,
'bin', 'arm-linux-androideabi-gcc');
if (!fs.isFileSync(ndkCompiler)) {
- throw new AndroidNdkSearchError('Can not locate GCC binary, tried $ndkCompiler');
+ throw AndroidNdkSearchError('Can not locate GCC binary, tried $ndkCompiler');
}
return ndkCompiler;
@@ -193,7 +193,7 @@
final int suitableVersion = versions
.firstWhere((int version) => version >= 9, orElse: () => null);
if (suitableVersion == null) {
- throw new AndroidNdkSearchError('Can not locate a suitable platform ARM sysroot (need android-9 or newer), tried to look in $platformsDir');
+ throw AndroidNdkSearchError('Can not locate a suitable platform ARM sysroot (need android-9 or newer), tried to look in $platformsDir');
}
final String armPlatform = fs.path.join(ndkDirectory, 'platforms',
@@ -204,7 +204,7 @@
final String ndkDir = findBundle(androidHomeDir);
final String ndkCompiler = findCompiler(ndkDir);
final List<String> ndkCompilerArgs = findSysroot(ndkDir);
- return new AndroidNdk._(ndkDir, ndkCompiler, ndkCompilerArgs);
+ return AndroidNdk._(ndkDir, ndkCompiler, ndkCompilerArgs);
}
/// Returns a descriptive message explaining why NDK can not be found within
@@ -300,7 +300,7 @@
// exceptions.
}
- return new AndroidSdk(androidHomeDir, ndk);
+ return AndroidSdk(androidHomeDir, ndk);
}
static bool validSdkDirectory(String dir) {
@@ -372,7 +372,7 @@
.listSync()
.map((FileSystemEntity entity) {
try {
- return new Version.parse(entity.basename);
+ return Version.parse(entity.basename);
} catch (error) {
return null;
}
@@ -412,7 +412,7 @@
if (buildToolsVersion == null)
return null;
- return new AndroidSdkVersion._(
+ return AndroidSdkVersion._(
this,
sdkLevel: platformVersion,
platformName: platformName,
diff --git a/packages/flutter_tools/lib/src/android/android_studio.dart b/packages/flutter_tools/lib/src/android/android_studio.dart
index d437162..9cf6898 100644
--- a/packages/flutter_tools/lib/src/android/android_studio.dart
+++ b/packages/flutter_tools/lib/src/android/android_studio.dart
@@ -25,7 +25,7 @@
// $HOME/Applications/Android Studio.app/Contents/
final RegExp _dotHomeStudioVersionMatcher =
- new RegExp(r'^\.AndroidStudio([^\d]*)([\d.]+)');
+ RegExp(r'^\.AndroidStudio([^\d]*)([\d.]+)');
String get javaPath => androidStudio?.javaPath;
@@ -54,8 +54,8 @@
Version version;
if (versionString != null)
- version = new Version.parse(versionString);
- return new AndroidStudio(studioPath, version: version);
+ version = Version.parse(versionString);
+ return AndroidStudio(studioPath, version: version);
}
factory AndroidStudio.fromHomeDot(Directory homeDotDir) {
@@ -64,7 +64,7 @@
if (versionMatch?.groupCount != 2) {
return null;
}
- final Version version = new Version.parse(versionMatch[2]);
+ final Version version = Version.parse(versionMatch[2]);
if (version == null) {
return null;
}
@@ -77,7 +77,7 @@
// ignored, installPath will be null, which is handled below
}
if (installPath != null && fs.isDirectorySync(installPath)) {
- return new AndroidStudio(installPath, version: version);
+ return AndroidStudio(installPath, version: version);
}
return null;
}
@@ -123,7 +123,7 @@
String configuredStudioPath = configuredStudio;
if (platform.isMacOS && !configuredStudioPath.endsWith('Contents'))
configuredStudioPath = fs.path.join(configuredStudioPath, 'Contents');
- return new AndroidStudio(configuredStudioPath,
+ return AndroidStudio(configuredStudioPath,
configured: configuredStudio);
}
@@ -181,7 +181,7 @@
}
return candidatePaths
- .map((FileSystemEntity e) => new AndroidStudio.fromMacOSBundle(e.path))
+ .map((FileSystemEntity e) => AndroidStudio.fromMacOSBundle(e.path))
.where((AndroidStudio s) => s != null)
.toList();
}
@@ -205,7 +205,7 @@
if (fs.directory(homeDirPath).existsSync()) {
for (FileSystemEntity entity in fs.directory(homeDirPath).listSync()) {
if (entity is Directory && entity.basename.startsWith('.AndroidStudio')) {
- final AndroidStudio studio = new AndroidStudio.fromHomeDot(entity);
+ final AndroidStudio studio = AndroidStudio.fromHomeDot(entity);
if (studio != null && !_hasStudioAt(studio.directory, newerThan: studio.version)) {
studios.removeWhere((AndroidStudio other) => other.directory == studio.directory);
studios.add(studio);
@@ -216,14 +216,14 @@
final String configuredStudioDir = config.getValue('android-studio-dir');
if (configuredStudioDir != null && !_hasStudioAt(configuredStudioDir)) {
- studios.add(new AndroidStudio(configuredStudioDir,
+ studios.add(AndroidStudio(configuredStudioDir,
configured: configuredStudioDir));
}
if (platform.isLinux) {
void _checkWellKnownPath(String path) {
if (fs.isDirectorySync(path) && !_hasStudioAt(path)) {
- studios.add(new AndroidStudio(path));
+ studios.add(AndroidStudio(path));
}
}
diff --git a/packages/flutter_tools/lib/src/android/android_studio_validator.dart b/packages/flutter_tools/lib/src/android/android_studio_validator.dart
index 9dafcdd..50ae46e 100644
--- a/packages/flutter_tools/lib/src/android/android_studio_validator.dart
+++ b/packages/flutter_tools/lib/src/android/android_studio_validator.dart
@@ -19,10 +19,10 @@
final List<DoctorValidator> validators = <DoctorValidator>[];
final List<AndroidStudio> studios = AndroidStudio.allInstalled();
if (studios.isEmpty) {
- validators.add(new NoAndroidStudioValidator());
+ validators.add(NoAndroidStudioValidator());
} else {
validators.addAll(studios
- .map((AndroidStudio studio) => new AndroidStudioValidator(studio)));
+ .map((AndroidStudio studio) => AndroidStudioValidator(studio)));
}
return validators;
}
@@ -36,9 +36,9 @@
? null
: 'version ${_studio.version}';
messages
- .add(new ValidationMessage('Android Studio at ${_studio.directory}'));
+ .add(ValidationMessage('Android Studio at ${_studio.directory}'));
- final IntelliJPlugins plugins = new IntelliJPlugins(_studio.pluginsPath);
+ final IntelliJPlugins plugins = IntelliJPlugins(_studio.pluginsPath);
plugins.validatePackage(messages, <String>['flutter-intellij', 'flutter-intellij.jar'],
'Flutter', minVersion: IntelliJPlugins.kMinFlutterPluginVersion);
plugins.validatePackage(messages, <String>['Dart'], 'Dart');
@@ -46,20 +46,20 @@
if (_studio.isValid) {
type = ValidationType.installed;
messages.addAll(_studio.validationMessages
- .map((String m) => new ValidationMessage(m)));
+ .map((String m) => ValidationMessage(m)));
} else {
type = ValidationType.partial;
messages.addAll(_studio.validationMessages
- .map((String m) => new ValidationMessage.error(m)));
- messages.add(new ValidationMessage(
+ .map((String m) => ValidationMessage.error(m)));
+ messages.add(ValidationMessage(
'Try updating or re-installing Android Studio.'));
if (_studio.configured != null) {
- messages.add(new ValidationMessage(
+ messages.add(ValidationMessage(
'Consider removing your android-studio-dir setting by running:\nflutter config --android-studio-dir='));
}
}
- return new ValidationResult(type, messages, statusInfo: studioVersionText);
+ return ValidationResult(type, messages, statusInfo: studioVersionText);
}
}
@@ -73,14 +73,14 @@
final String cfgAndroidStudio = config.getValue('android-studio-dir');
if (cfgAndroidStudio != null) {
messages.add(
- new ValidationMessage.error('android-studio-dir = $cfgAndroidStudio\n'
+ ValidationMessage.error('android-studio-dir = $cfgAndroidStudio\n'
'but Android Studio not found at this location.'));
}
- messages.add(new ValidationMessage(
+ messages.add(ValidationMessage(
'Android Studio not found; download from https://developer.android.com/studio/index.html\n'
'(or visit https://flutter.io/setup/#android-setup for detailed instructions).'));
- return new ValidationResult(ValidationType.missing, messages,
+ return ValidationResult(ValidationType.missing, messages,
statusInfo: 'not installed');
}
}
diff --git a/packages/flutter_tools/lib/src/android/android_workflow.dart b/packages/flutter_tools/lib/src/android/android_workflow.dart
index 7f55676..3cadb25 100644
--- a/packages/flutter_tools/lib/src/android/android_workflow.dart
+++ b/packages/flutter_tools/lib/src/android/android_workflow.dart
@@ -27,9 +27,9 @@
unknown,
}
-final RegExp licenseCounts = new RegExp(r'(\d+) of (\d+) SDK package licenses? not accepted.');
-final RegExp licenseNotAccepted = new RegExp(r'licenses? not accepted', caseSensitive: false);
-final RegExp licenseAccepted = new RegExp(r'All SDK package licenses accepted.');
+final RegExp licenseCounts = RegExp(r'(\d+) of (\d+) SDK package licenses? not accepted.');
+final RegExp licenseNotAccepted = RegExp(r'licenses? not accepted', caseSensitive: false);
+final RegExp licenseAccepted = RegExp(r'All SDK package licenses accepted.');
class AndroidWorkflow implements Workflow {
@override
@@ -55,7 +55,7 @@
/// is not compatible.
bool _checkJavaVersion(String javaBinary, List<ValidationMessage> messages) {
if (!processManager.canRun(javaBinary)) {
- messages.add(new ValidationMessage.error('Cannot execute $javaBinary to determine the version'));
+ messages.add(ValidationMessage.error('Cannot execute $javaBinary to determine the version'));
return false;
}
String javaVersion;
@@ -69,10 +69,10 @@
} catch (_) { /* ignore */ }
if (javaVersion == null) {
// Could not determine the java version.
- messages.add(new ValidationMessage.error('Could not determine java version'));
+ messages.add(ValidationMessage.error('Could not determine java version'));
return false;
}
- messages.add(new ValidationMessage('Java version $javaVersion'));
+ messages.add(ValidationMessage('Java version $javaVersion'));
// TODO(johnmccutchan): Validate version.
return true;
}
@@ -85,12 +85,12 @@
// No Android SDK found.
if (platform.environment.containsKey(kAndroidHome)) {
final String androidHomeDir = platform.environment[kAndroidHome];
- messages.add(new ValidationMessage.error(
+ messages.add(ValidationMessage.error(
'$kAndroidHome = $androidHomeDir\n'
'but Android SDK not found at this location.'
));
} else {
- messages.add(new ValidationMessage.error(
+ messages.add(ValidationMessage.error(
'Unable to locate Android SDK.\n'
'Install Android Studio from: https://developer.android.com/studio/index.html\n'
'On first launch it will assist you in installing the Android SDK components.\n'
@@ -99,12 +99,12 @@
));
}
- return new ValidationResult(ValidationType.missing, messages);
+ return ValidationResult(ValidationType.missing, messages);
}
- messages.add(new ValidationMessage('Android SDK at ${androidSdk.directory}'));
+ messages.add(ValidationMessage('Android SDK at ${androidSdk.directory}'));
- messages.add(new ValidationMessage(androidSdk.ndk == null
+ messages.add(ValidationMessage(androidSdk.ndk == null
? 'Android NDK location not configured (optional; useful for native profiling support)'
: 'Android NDK at ${androidSdk.ndk.directory}'));
@@ -112,7 +112,7 @@
if (androidSdk.latestVersion != null) {
sdkVersionText = 'Android SDK ${androidSdk.latestVersion.buildToolsVersionName}';
- messages.add(new ValidationMessage(
+ messages.add(ValidationMessage(
'Platform ${androidSdk.latestVersion.platformName}, '
'build-tools ${androidSdk.latestVersion.buildToolsVersionName}'
));
@@ -120,7 +120,7 @@
if (platform.environment.containsKey(kAndroidHome)) {
final String androidHomeDir = platform.environment[kAndroidHome];
- messages.add(new ValidationMessage('$kAndroidHome = $androidHomeDir'));
+ messages.add(ValidationMessage('$kAndroidHome = $androidHomeDir'));
}
final List<String> validationResult = androidSdk.validateSdkWellFormed();
@@ -128,48 +128,48 @@
if (validationResult.isNotEmpty) {
// Android SDK is not functional.
messages.addAll(validationResult.map((String message) {
- return new ValidationMessage.error(message);
+ return ValidationMessage.error(message);
}));
- messages.add(new ValidationMessage(
+ messages.add(ValidationMessage(
'Try re-installing or updating your Android SDK,\n'
'visit https://flutter.io/setup/#android-setup for detailed instructions.'));
- return new ValidationResult(ValidationType.partial, messages, statusInfo: sdkVersionText);
+ return ValidationResult(ValidationType.partial, messages, statusInfo: sdkVersionText);
}
// Now check for the JDK.
final String javaBinary = AndroidSdk.findJavaBinary();
if (javaBinary == null) {
- messages.add(new ValidationMessage.error(
+ messages.add(ValidationMessage.error(
'No Java Development Kit (JDK) found; You must have the environment '
'variable JAVA_HOME set and the java binary in your PATH. '
'You can download the JDK from $_jdkDownload.'));
- return new ValidationResult(ValidationType.partial, messages, statusInfo: sdkVersionText);
+ return ValidationResult(ValidationType.partial, messages, statusInfo: sdkVersionText);
}
- messages.add(new ValidationMessage('Java binary at: $javaBinary'));
+ messages.add(ValidationMessage('Java binary at: $javaBinary'));
// Check JDK version.
if (!_checkJavaVersion(javaBinary, messages)) {
- return new ValidationResult(ValidationType.partial, messages, statusInfo: sdkVersionText);
+ return ValidationResult(ValidationType.partial, messages, statusInfo: sdkVersionText);
}
// Check for licenses.
switch (await licensesAccepted) {
case LicensesAccepted.all:
- messages.add(new ValidationMessage('All Android licenses accepted.'));
+ messages.add(ValidationMessage('All Android licenses accepted.'));
break;
case LicensesAccepted.some:
- messages.add(new ValidationMessage.hint('Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses'));
- return new ValidationResult(ValidationType.partial, messages, statusInfo: sdkVersionText);
+ messages.add(ValidationMessage.hint('Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses'));
+ return ValidationResult(ValidationType.partial, messages, statusInfo: sdkVersionText);
case LicensesAccepted.none:
- messages.add(new ValidationMessage.error('Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses'));
- return new ValidationResult(ValidationType.partial, messages, statusInfo: sdkVersionText);
+ messages.add(ValidationMessage.error('Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses'));
+ return ValidationResult(ValidationType.partial, messages, statusInfo: sdkVersionText);
case LicensesAccepted.unknown:
- messages.add(new ValidationMessage.error('Android license status unknown.'));
- return new ValidationResult(ValidationType.partial, messages, statusInfo: sdkVersionText);
+ messages.add(ValidationMessage.error('Android license status unknown.'));
+ return ValidationResult(ValidationType.partial, messages, statusInfo: sdkVersionText);
}
// Success.
- return new ValidationResult(ValidationType.installed, messages, statusInfo: sdkVersionText);
+ return ValidationResult(ValidationType.installed, messages, statusInfo: sdkVersionText);
}
Future<LicensesAccepted> get licensesAccepted async {
@@ -227,7 +227,7 @@
_ensureCanRunSdkManager();
- final Version sdkManagerVersion = new Version.parse(androidSdk.sdkManagerVersion);
+ final Version sdkManagerVersion = Version.parse(androidSdk.sdkManagerVersion);
if (sdkManagerVersion == null || sdkManagerVersion.major < 26)
// SDK manager is found, but needs to be updated.
throwToolExit(
diff --git a/packages/flutter_tools/lib/src/android/gradle.dart b/packages/flutter_tools/lib/src/android/gradle.dart
index bbe5c2f..e5bdc36 100644
--- a/packages/flutter_tools/lib/src/android/gradle.dart
+++ b/packages/flutter_tools/lib/src/android/gradle.dart
@@ -24,7 +24,7 @@
import 'android_studio.dart';
const String gradleVersion = '4.4';
-final RegExp _assembleTaskPattern = new RegExp(r'assemble([^:]+): task ');
+final RegExp _assembleTaskPattern = RegExp(r'assemble([^:]+): task ');
GradleProject _cachedGradleProject;
String _cachedGradleExecutable;
@@ -39,7 +39,7 @@
// Investigation documented in #13975 suggests the filter should be a subset
// of the impact of -q, but users insist they see the error message sometimes
// anyway. If we can prove it really is impossible, delete the filter.
-final RegExp ndkMessageFilter = new RegExp(r'^(?!NDK is missing a ".*" directory'
+final RegExp ndkMessageFilter = RegExp(r'^(?!NDK is missing a ".*" directory'
r'|If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning'
r'|If you are using NDK, verify the ndk.dir is set to a valid NDK directory. It is currently set to .*)');
@@ -57,7 +57,7 @@
fs.path.join('app', 'build.gradle'));
if (appGradle.existsSync()) {
for (String line in appGradle.readAsLinesSync()) {
- if (line.contains(new RegExp(r'apply from: .*/flutter.gradle'))) {
+ if (line.contains(RegExp(r'apply from: .*/flutter.gradle'))) {
return FlutterPluginVersion.managed;
}
if (line.contains("def flutterPluginVersion = 'managed'")) {
@@ -103,7 +103,7 @@
environment: _gradleEnv,
);
final String properties = runResult.stdout.trim();
- project = new GradleProject.fromAppProperties(properties);
+ project = GradleProject.fromAppProperties(properties);
} catch (exception) {
if (getFlutterPluginVersion(flutterProject.android) == FlutterPluginVersion.managed) {
status.cancel();
@@ -115,7 +115,7 @@
throwToolExit('Please review your Gradle project setup in the android/ folder.');
}
// Fall back to the default
- project = new GradleProject(
+ project = GradleProject(
<String>['debug', 'profile', 'release'],
<String>[], flutterProject.android.gradleAppOutV1Directory,
);
@@ -131,7 +131,7 @@
const String matcher =
r'You have not accepted the license agreements of the following SDK components:'
r'\s*\[(.+)\]';
- final RegExp licenseFailure = new RegExp(matcher, multiLine: true);
+ final RegExp licenseFailure = RegExp(matcher, multiLine: true);
final Match licenseMatch = licenseFailure.firstMatch(exceptionString);
if (licenseMatch != null) {
final String missingLicenses = licenseMatch.group(1);
@@ -219,9 +219,9 @@
SettingsFile settings;
if (localProperties.existsSync()) {
- settings = new SettingsFile.parseFromFile(localProperties);
+ settings = SettingsFile.parseFromFile(localProperties);
} else {
- settings = new SettingsFile();
+ settings = SettingsFile();
changed = true;
}
@@ -254,7 +254,7 @@
///
/// Writes the path to the Android SDK, if known.
void writeLocalProperties(File properties) {
- final SettingsFile settings = new SettingsFile();
+ final SettingsFile settings = SettingsFile();
if (androidSdk != null) {
settings.values['sdk.dir'] = escapePath(androidSdk.directory);
}
@@ -424,7 +424,7 @@
}
Map<String, String> get _gradleEnv {
- final Map<String, String> env = new Map<String, String>.from(platform.environment);
+ final Map<String, String> env = Map<String, String>.from(platform.environment);
if (javaPath != null) {
// Use java bundled with Android Studio.
env['JAVA_HOME'] = javaPath;
@@ -444,7 +444,7 @@
.trim();
// Extract build types and product flavors.
- final Set<String> variants = new Set<String>();
+ final Set<String> variants = Set<String>();
for (String s in properties.split('\n')) {
final Match match = _assembleTaskPattern.matchAsPrefix(s);
if (match != null) {
@@ -453,8 +453,8 @@
variants.add(variant);
}
}
- final Set<String> buildTypes = new Set<String>();
- final Set<String> productFlavors = new Set<String>();
+ final Set<String> buildTypes = Set<String>();
+ final Set<String> productFlavors = Set<String>();
for (final String variant1 in variants) {
for (final String variant2 in variants) {
if (variant2.startsWith(variant1) && variant2 != variant1) {
@@ -468,7 +468,7 @@
}
if (productFlavors.isEmpty)
buildTypes.addAll(variants);
- return new GradleProject(
+ return GradleProject(
buildTypes.toList(),
productFlavors.toList(),
fs.directory(fs.path.join(buildDir, 'outputs', 'apk')),
diff --git a/packages/flutter_tools/lib/src/application_package.dart b/packages/flutter_tools/lib/src/application_package.dart
index f71c0ae..03fbd9b 100644
--- a/packages/flutter_tools/lib/src/application_package.dart
+++ b/packages/flutter_tools/lib/src/application_package.dart
@@ -81,7 +81,7 @@
return null;
}
- return new AndroidApk(
+ return AndroidApk(
id: data.packageName,
file: apk,
launchActivity: '${data.packageName}/${data.launchableActivityName}'
@@ -97,7 +97,7 @@
if (apkFile.existsSync()) {
// Grab information from the .apk. The gradle build script might alter
// the application Id, so we need to look at what was actually built.
- return new AndroidApk.fromApk(apkFile);
+ return AndroidApk.fromApk(apkFile);
}
// The .apk hasn't been built yet, so we work with what we have. The run
// command will grab a new AndroidApk after building, to get the updated
@@ -135,7 +135,7 @@
if (packageId == null || launchActivity == null)
return null;
- return new AndroidApk(
+ return AndroidApk(
id: packageId,
file: apkFile,
launchActivity: launchActivity
@@ -209,7 +209,7 @@
return null;
}
- return new PrebuiltIOSApp(
+ return PrebuiltIOSApp(
bundleDir: bundleDir,
bundleName: fs.path.basename(bundleDir.path),
projectBundleId: id,
@@ -219,7 +219,7 @@
factory IOSApp.fromIosProject(IosProject project) {
if (getCurrentHostPlatform() != HostPlatform.darwin_x64)
return null;
- return new BuildableIOSApp(project);
+ return BuildableIOSApp(project);
}
@override
@@ -281,13 +281,13 @@
case TargetPlatform.android_x86:
return applicationBinary == null
? await AndroidApk.fromAndroidProject((await FlutterProject.current()).android)
- : new AndroidApk.fromApk(applicationBinary);
+ : AndroidApk.fromApk(applicationBinary);
case TargetPlatform.ios:
return applicationBinary == null
- ? new IOSApp.fromIosProject((await FlutterProject.current()).ios)
- : new IOSApp.fromPrebuiltApp(applicationBinary);
+ ? IOSApp.fromIosProject((await FlutterProject.current()).ios)
+ : IOSApp.fromPrebuiltApp(applicationBinary);
case TargetPlatform.tester:
- return new FlutterTesterApp.fromCurrentDirectory();
+ return FlutterTesterApp.fromCurrentDirectory();
case TargetPlatform.darwin_x64:
case TargetPlatform.linux_x64:
case TargetPlatform.windows_x64:
@@ -395,7 +395,7 @@
final List<String> lines = data.split('\n');
assert(lines.length > 3);
- final _Element manifest = new _Element.fromLine(lines[1], null);
+ final _Element manifest = _Element.fromLine(lines[1], null);
_Element currentElement = manifest;
for (String line in lines.skip(2)) {
@@ -411,10 +411,10 @@
switch (trimLine[0]) {
case 'A':
currentElement
- .addChild(new _Attribute.fromLine(line, currentElement));
+ .addChild(_Attribute.fromLine(line, currentElement));
break;
case 'E':
- final _Element element = new _Element.fromLine(line, currentElement);
+ final _Element element = _Element.fromLine(line, currentElement);
currentElement.addChild(element);
currentElement = element;
}
@@ -453,14 +453,14 @@
map['package'] = <String, String>{'name': packageName};
map['launchable-activity'] = <String, String>{'name': activityName};
- return new ApkManifestData._(map);
+ return ApkManifestData._(map);
}
final Map<String, Map<String, String>> _data;
@visibleForTesting
Map<String, Map<String, String>> get data =>
- new UnmodifiableMapView<String, Map<String, String>>(_data);
+ UnmodifiableMapView<String, Map<String, String>>(_data);
String get packageName => _data['package'] == null ? null : _data['package']['name'];
diff --git a/packages/flutter_tools/lib/src/artifacts.dart b/packages/flutter_tools/lib/src/artifacts.dart
index 4d9a18c..06765c9 100644
--- a/packages/flutter_tools/lib/src/artifacts.dart
+++ b/packages/flutter_tools/lib/src/artifacts.dart
@@ -89,7 +89,7 @@
static Artifacts get instance => context[Artifacts];
static LocalEngineArtifacts getLocalEngine(String engineSrcPath, EngineBuildPaths engineBuildPaths) {
- return new LocalEngineArtifacts(engineSrcPath, engineBuildPaths.targetEngine, engineBuildPaths.hostEngine);
+ return LocalEngineArtifacts(engineSrcPath, engineBuildPaths.targetEngine, engineBuildPaths.hostEngine);
}
// Returns the requested [artifact] for the [platform] and [mode] combination.
@@ -233,7 +233,7 @@
return TargetPlatform.linux_x64;
if (platform.isWindows)
return TargetPlatform.windows_x64;
- throw new UnimplementedError('Host OS not supported.');
+ throw UnimplementedError('Host OS not supported.');
}
}
@@ -300,7 +300,7 @@
if (processManager.canRun(genSnapshotPath))
return genSnapshotPath;
}
- throw new Exception('Unable to find $genSnapshotName');
+ throw Exception('Unable to find $genSnapshotName');
}
String _flutterTesterPath(TargetPlatform platform) {
@@ -311,6 +311,6 @@
} else if (getCurrentHostPlatform() == HostPlatform.windows_x64) {
return fs.path.join(engineOutPath, 'flutter_tester.exe');
}
- throw new Exception('Unsupported platform $platform.');
+ throw Exception('Unsupported platform $platform.');
}
}
diff --git a/packages/flutter_tools/lib/src/asset.dart b/packages/flutter_tools/lib/src/asset.dart
index e0d84eb..22b7b24 100644
--- a/packages/flutter_tools/lib/src/asset.dart
+++ b/packages/flutter_tools/lib/src/asset.dart
@@ -52,7 +52,7 @@
const _ManifestAssetBundleFactory();
@override
- AssetBundle createBundle() => new _ManifestAssetBundle();
+ AssetBundle createBundle() => _ManifestAssetBundle();
}
class _ManifestAssetBundle implements AssetBundle {
@@ -108,15 +108,15 @@
return 1;
if (flutterManifest.isEmpty) {
- entries[_assetManifestJson] = new DevFSStringContent('{}');
+ entries[_assetManifestJson] = DevFSStringContent('{}');
return 0;
}
final String assetBasePath = fs.path.dirname(fs.path.absolute(manifestPath));
- _lastBuildTimestamp = new DateTime.now();
+ _lastBuildTimestamp = DateTime.now();
- final PackageMap packageMap = new PackageMap(packagesPath);
+ final PackageMap packageMap = PackageMap(packagesPath);
// The _assetVariants map contains an entry for each asset listed
// in the pubspec.yaml file's assets and font and sections. The
@@ -191,7 +191,7 @@
}
for (_Asset variant in assetVariants[asset]) {
assert(variant.assetFileExists);
- entries[variant.entryUri.path] = new DevFSFileContent(variant.assetFile);
+ entries[variant.entryUri.path] = DevFSFileContent(variant.assetFile);
}
}
@@ -201,12 +201,12 @@
}
for (_Asset asset in materialAssets) {
assert(asset.assetFileExists);
- entries[asset.entryUri.path] = new DevFSFileContent(asset.assetFile);
+ entries[asset.entryUri.path] = DevFSFileContent(asset.assetFile);
}
entries[_assetManifestJson] = _createAssetManifest(assetVariants);
- entries[_fontManifestJson] = new DevFSStringContent(json.encode(fonts));
+ entries[_fontManifestJson] = DevFSStringContent(json.encode(fonts));
// TODO(ianh): Only do the following line if we've changed packages or if our LICENSE file changed
entries[_license] = await _obtainLicenses(packageMap, assetBasePath, reportPackages: reportLicensedPackages);
@@ -239,7 +239,7 @@
if (entryUri == relativeUri)
return null;
final int index = entryUri.path.indexOf(relativeUri.path);
- return index == -1 ? null : new Uri(path: entryUri.path.substring(0, index));
+ return index == -1 ? null : Uri(path: entryUri.path.substring(0, index));
}
@override
@@ -285,9 +285,9 @@
for (Map<String, dynamic> family in _getMaterialFonts(fontSet)) {
for (Map<dynamic, dynamic> font in family['fonts']) {
final Uri entryUri = fs.path.toUri(font['asset']);
- result.add(new _Asset(
+ result.add(_Asset(
baseDir: fs.path.join(Cache.flutterRoot, 'bin', 'cache', 'artifacts', 'material_fonts'),
- relativeUri: new Uri(path: entryUri.pathSegments.last),
+ relativeUri: Uri(path: entryUri.pathSegments.last),
entryUri: entryUri
));
}
@@ -318,7 +318,7 @@
// example, a package might itself contain code from multiple third-party
// sources, and might need to include a license for each one.)
final Map<String, Set<String>> packageLicenses = <String, Set<String>>{};
- final Set<String> allPackages = new Set<String>();
+ final Set<String> allPackages = Set<String>();
for (String packageName in packageMap.map.keys) {
final Uri package = packageMap.map[packageName];
if (package != null && package.scheme == 'file') {
@@ -340,7 +340,7 @@
packageNames = <String>[packageName];
licenseText = rawLicense;
}
- packageLicenses.putIfAbsent(licenseText, () => new Set<String>())
+ packageLicenses.putIfAbsent(licenseText, () => Set<String>())
..addAll(packageNames);
allPackages.addAll(packageNames);
}
@@ -365,7 +365,7 @@
final String combinedLicenses = combinedLicensesList.join(_licenseSeparator);
- return new DevFSStringContent(combinedLicenses);
+ return DevFSStringContent(combinedLicenses);
}
int _byBasename(_Asset a, _Asset b) {
@@ -386,7 +386,7 @@
variants.add(variant.entryUri.path);
jsonObject[main.entryUri.path] = variants;
}
- return new DevFSStringContent(json.encode(jsonObject));
+ return DevFSStringContent(json.encode(jsonObject));
}
List<Map<String, dynamic>> _parseFonts(
@@ -425,20 +425,20 @@
final Uri assetUri = fontAsset.assetUri;
if (assetUri.pathSegments.first == 'packages' &&
!fs.isFileSync(fs.path.fromUri(packageMap.map[packageName].resolve('../${assetUri.path}')))) {
- packageFontAssets.add(new FontAsset(
+ packageFontAssets.add(FontAsset(
fontAsset.assetUri,
weight: fontAsset.weight,
style: fontAsset.style,
));
} else {
- packageFontAssets.add(new FontAsset(
- new Uri(pathSegments: <String>['packages', packageName]..addAll(assetUri.pathSegments)),
+ packageFontAssets.add(FontAsset(
+ Uri(pathSegments: <String>['packages', packageName]..addAll(assetUri.pathSegments)),
weight: fontAsset.weight,
style: fontAsset.style,
));
}
}
- packageFonts.add(new Font('packages/$packageName/${font.familyName}', packageFontAssets));
+ packageFonts.add(Font('packages/$packageName/${font.familyName}', packageFontAssets));
}
return packageFonts;
}
@@ -528,7 +528,7 @@
}) {
final Map<_Asset, List<_Asset>> result = <_Asset, List<_Asset>>{};
- final _AssetDirectoryCache cache = new _AssetDirectoryCache(excludeDirs);
+ final _AssetDirectoryCache cache = _AssetDirectoryCache(excludeDirs);
for (Uri assetUri in flutterManifest.assets) {
if (assetUri.toString().endsWith('/')) {
_parseAssetsFromFolder(packageMap, flutterManifest, assetBase,
@@ -585,7 +585,7 @@
if (entity is File) {
final String relativePath = fs.path.relative(entity.path, from: assetBase);
- final Uri uri = new Uri.file(relativePath, windows: platform.isWindows);
+ final Uri uri = Uri.file(relativePath, windows: platform.isWindows);
_parseAssetFromFile(packageMap, flutterManifest, assetBase, cache, result,
uri, packageName: packageName);
@@ -617,7 +617,7 @@
: asset.symbolicPrefixUri.resolveUri(relativeUri);
variants.add(
- new _Asset(
+ _Asset(
baseDir: asset.baseDir,
entryUri: entryUri,
relativeUri: relativeUri,
@@ -643,11 +643,11 @@
return packageAsset;
}
- return new _Asset(
+ return _Asset(
baseDir: assetsBaseDir,
entryUri: packageName == null
? assetUri // Asset from the current application.
- : new Uri(pathSegments: <String>['packages', packageName]..addAll(assetUri.pathSegments)), // Asset from, and declared in $packageName.
+ : Uri(pathSegments: <String>['packages', packageName]..addAll(assetUri.pathSegments)), // Asset from, and declared in $packageName.
relativeUri: assetUri,
);
}
@@ -658,10 +658,10 @@
final String packageName = assetUri.pathSegments[1];
final Uri packageUri = packageMap.map[packageName];
if (packageUri != null && packageUri.scheme == 'file') {
- return new _Asset(
+ return _Asset(
baseDir: fs.path.fromUri(packageUri),
entryUri: assetUri,
- relativeUri: new Uri(pathSegments: assetUri.pathSegments.sublist(2)),
+ relativeUri: Uri(pathSegments: assetUri.pathSegments.sublist(2)),
);
}
}
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.
diff --git a/packages/flutter_tools/lib/src/build_info.dart b/packages/flutter_tools/lib/src/build_info.dart
index 0b4e031..7db6522 100644
--- a/packages/flutter_tools/lib/src/build_info.dart
+++ b/packages/flutter_tools/lib/src/build_info.dart
@@ -94,7 +94,7 @@
String get modeName => getModeName(mode);
BuildInfo withTargetPlatform(TargetPlatform targetPlatform) =>
- new BuildInfo(mode, flavor,
+ BuildInfo(mode, flavor,
trackWidgetCreation: trackWidgetCreation,
compilationTraceFilePath: compilationTraceFilePath,
extraFrontEndOptions: extraFrontEndOptions,
@@ -259,7 +259,7 @@
final String buildDir = config.getValue('build-dir') ?? 'build';
if (fs.path.isAbsolute(buildDir)) {
- throw new Exception(
+ throw Exception(
'build-dir config setting in ${config.configPath} must be relative');
}
return buildDir;
diff --git a/packages/flutter_tools/lib/src/bundle.dart b/packages/flutter_tools/lib/src/bundle.dart
index 8f3fe07..4d75a3d 100644
--- a/packages/flutter_tools/lib/src/bundle.dart
+++ b/packages/flutter_tools/lib/src/bundle.dart
@@ -79,13 +79,13 @@
if (compilerOutput?.outputFilename == null) {
throwToolExit('Compiler failed on $mainPath');
}
- kernelContent = new DevFSFileContent(fs.file(compilerOutput.outputFilename));
+ kernelContent = DevFSFileContent(fs.file(compilerOutput.outputFilename));
await fs.directory(getBuildDirectory()).childFile('frontend_server.d')
.writeAsString('frontend_server.d: ${artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk)}\n');
if (compilationTraceFilePath != null) {
- final CoreJITSnapshotter snapshotter = new CoreJITSnapshotter();
+ final CoreJITSnapshotter snapshotter = CoreJITSnapshotter();
final int snapshotExitCode = await snapshotter.build(
platform: platform,
buildMode: buildMode,
@@ -155,29 +155,29 @@
assetDirPath ??= getAssetBuildDirectory();
printTrace('Building bundle');
- final Map<String, DevFSContent> assetEntries = new Map<String, DevFSContent>.from(assetBundle.entries);
+ final Map<String, DevFSContent> assetEntries = Map<String, DevFSContent>.from(assetBundle.entries);
if (kernelContent != null) {
if (compilationTraceFilePath != null) {
final String vmSnapshotData = fs.path.join(getBuildDirectory(), _kVMSnapshotData);
final String vmSnapshotInstr = fs.path.join(getBuildDirectory(), _kVMSnapshotInstr);
final String isolateSnapshotData = fs.path.join(getBuildDirectory(), _kIsolateSnapshotData);
final String isolateSnapshotInstr = fs.path.join(getBuildDirectory(), _kIsolateSnapshotInstr);
- assetEntries[_kVMSnapshotData] = new DevFSFileContent(fs.file(vmSnapshotData));
- assetEntries[_kVMSnapshotInstr] = new DevFSFileContent(fs.file(vmSnapshotInstr));
- assetEntries[_kIsolateSnapshotData] = new DevFSFileContent(fs.file(isolateSnapshotData));
- assetEntries[_kIsolateSnapshotInstr] = new DevFSFileContent(fs.file(isolateSnapshotInstr));
+ assetEntries[_kVMSnapshotData] = DevFSFileContent(fs.file(vmSnapshotData));
+ assetEntries[_kVMSnapshotInstr] = DevFSFileContent(fs.file(vmSnapshotInstr));
+ assetEntries[_kIsolateSnapshotData] = DevFSFileContent(fs.file(isolateSnapshotData));
+ assetEntries[_kIsolateSnapshotInstr] = DevFSFileContent(fs.file(isolateSnapshotInstr));
} else {
final String platformKernelDill = artifacts.getArtifactPath(Artifact.platformKernelDill);
final String vmSnapshotData = artifacts.getArtifactPath(Artifact.vmSnapshotData);
final String isolateSnapshotData = artifacts.getArtifactPath(Artifact.isolateSnapshotData);
assetEntries[_kKernelKey] = kernelContent;
- assetEntries[_kPlatformKernelKey] = new DevFSFileContent(fs.file(platformKernelDill));
- assetEntries[_kVMSnapshotData] = new DevFSFileContent(fs.file(vmSnapshotData));
- assetEntries[_kIsolateSnapshotData] = new DevFSFileContent(fs.file(isolateSnapshotData));
+ assetEntries[_kPlatformKernelKey] = DevFSFileContent(fs.file(platformKernelDill));
+ assetEntries[_kVMSnapshotData] = DevFSFileContent(fs.file(vmSnapshotData));
+ assetEntries[_kIsolateSnapshotData] = DevFSFileContent(fs.file(isolateSnapshotData));
}
}
if (dylibFile != null)
- assetEntries[_kDylibKey] = new DevFSFileContent(dylibFile);
+ assetEntries[_kDylibKey] = DevFSFileContent(dylibFile);
printTrace('Writing asset files to $assetDirPath');
ensureDirectoryExists(assetDirPath);
diff --git a/packages/flutter_tools/lib/src/cache.dart b/packages/flutter_tools/lib/src/cache.dart
index ffc4af5..8e2325c 100644
--- a/packages/flutter_tools/lib/src/cache.dart
+++ b/packages/flutter_tools/lib/src/cache.dart
@@ -21,9 +21,9 @@
/// [artifacts] is configurable for testing.
Cache({ Directory rootOverride, List<CachedArtifact> artifacts }) : _rootOverride = rootOverride {
if (artifacts == null) {
- _artifacts.add(new MaterialFonts(this));
- _artifacts.add(new FlutterEngine(this));
- _artifacts.add(new GradleWrapper(this));
+ _artifacts.add(MaterialFonts(this));
+ _artifacts.add(FlutterEngine(this));
+ _artifacts.add(GradleWrapper(this));
} else {
_artifacts.addAll(artifacts);
}
@@ -87,7 +87,7 @@
printStatus('Waiting for another flutter command to release the startup lock...');
printed = true;
}
- await new Future<Null>.delayed(const Duration(milliseconds: 50));
+ await Future<Null>.delayed(const Duration(milliseconds: 50));
}
}
}
@@ -104,7 +104,7 @@
/// this very moment; throws a [StateError] if it doesn't.
static void checkLockAcquired() {
if (_lockEnabled && _lock == null && platform.environment['FLUTTER_ALREADY_LOCKED'] != 'true') {
- throw new StateError(
+ throw StateError(
'The current process does not own the lock for the cache directory. This is a bug in Flutter CLI tools.',
);
}
@@ -554,7 +554,7 @@
for (int codeUnit in fileName.codeUnits) {
replacedCodeUnits.addAll(_flattenNameSubstitutions[codeUnit] ?? <int>[codeUnit]);
}
- return new String.fromCharCodes(replacedCodeUnits);
+ return String.fromCharCodes(replacedCodeUnits);
}
@visibleForTesting
diff --git a/packages/flutter_tools/lib/src/commands/analyze.dart b/packages/flutter_tools/lib/src/commands/analyze.dart
index c79ba29..1da4c74 100644
--- a/packages/flutter_tools/lib/src/commands/analyze.dart
+++ b/packages/flutter_tools/lib/src/commands/analyze.dart
@@ -82,13 +82,13 @@
@override
Future<Null> runCommand() {
if (argResults['watch']) {
- return new AnalyzeContinuously(
+ return AnalyzeContinuously(
argResults,
runner.getRepoRoots(),
runner.getRepoPackages(),
).analyze();
} else {
- return new AnalyzeOnce(
+ return AnalyzeOnce(
argResults,
runner.getRepoRoots(),
runner.getRepoPackages(),
diff --git a/packages/flutter_tools/lib/src/commands/analyze_base.dart b/packages/flutter_tools/lib/src/commands/analyze_base.dart
index 5e07adc..04547d2 100644
--- a/packages/flutter_tools/lib/src/commands/analyze_base.dart
+++ b/packages/flutter_tools/lib/src/commands/analyze_base.dart
@@ -123,7 +123,7 @@
Map<String, PackageDependency> packages = <String, PackageDependency>{};
PackageDependency getPackageDependency(String packageName) {
- return packages.putIfAbsent(packageName, () => new PackageDependency());
+ return packages.putIfAbsent(packageName, () => PackageDependency());
}
/// Read the .packages file in [directory] and add referenced packages to [dependencies].
@@ -135,7 +135,7 @@
final Iterable<String> lines = dotPackages
.readAsStringSync()
.split('\n')
- .where((String line) => !line.startsWith(new RegExp(r'^ *#')));
+ .where((String line) => !line.startsWith(RegExp(r'^ *#')));
for (String line in lines) {
final int colon = line.indexOf(':');
if (colon > 0) {
@@ -177,7 +177,7 @@
// prepare a union of all the .packages files
if (dependencies.hasConflicts) {
- final StringBuffer message = new StringBuffer();
+ final StringBuffer message = StringBuffer();
message.writeln(dependencies.generateConflictReport());
message.writeln('Make sure you have run "pub upgrade" in all the directories mentioned above.');
if (dependencies.hasConflictsAffectingFlutterRepo) {
@@ -205,7 +205,7 @@
String generateConflictReport() {
assert(hasConflicts);
- final StringBuffer result = new StringBuffer();
+ final StringBuffer result = StringBuffer();
for (String package in packages.keys.where((String package) => packages[package].hasConflict)) {
result.writeln('Package "$package" has conflicts:');
packages[package].describeConflict(result);
diff --git a/packages/flutter_tools/lib/src/commands/analyze_continuously.dart b/packages/flutter_tools/lib/src/commands/analyze_continuously.dart
index 3309753..c326608 100644
--- a/packages/flutter_tools/lib/src/commands/analyze_continuously.dart
+++ b/packages/flutter_tools/lib/src/commands/analyze_continuously.dart
@@ -26,7 +26,7 @@
String analysisTarget;
bool firstAnalysis = true;
- Set<String> analyzedPaths = new Set<String>();
+ Set<String> analyzedPaths = Set<String>();
Map<String, List<AnalysisError>> analysisErrors = <String, List<AnalysisError>>{};
Stopwatch analysisTimer;
int lastErrorCount = 0;
@@ -37,7 +37,7 @@
List<String> directories;
if (argResults['flutter-repo']) {
- final PackageDependencyTracker dependencies = new PackageDependencyTracker();
+ final PackageDependencyTracker dependencies = PackageDependencyTracker();
dependencies.checkForConflictingDependencies(repoPackages, dependencies);
directories = repoRoots;
@@ -54,7 +54,7 @@
final String sdkPath = argResults['dart-sdk'] ?? sdk.dartSdkPath;
- final AnalysisServer server = new AnalysisServer(sdkPath, directories);
+ final AnalysisServer server = AnalysisServer(sdkPath, directories);
server.onAnalyzing.listen((bool isAnalyzing) => _handleAnalysisStatus(server, isAnalyzing));
server.onErrors.listen(_handleAnalysisErrors);
@@ -76,7 +76,7 @@
printStatus('\n');
analysisStatus = logger.startProgress('Analyzing $analysisTarget...');
analyzedPaths.clear();
- analysisTimer = new Stopwatch()..start();
+ analysisTimer = Stopwatch()..start();
} else {
analysisStatus?.stop();
analysisTimer.stop();
diff --git a/packages/flutter_tools/lib/src/commands/analyze_once.dart b/packages/flutter_tools/lib/src/commands/analyze_once.dart
index 84d02a3..ae14c97 100644
--- a/packages/flutter_tools/lib/src/commands/analyze_once.dart
+++ b/packages/flutter_tools/lib/src/commands/analyze_once.dart
@@ -38,7 +38,7 @@
(workingDirectory ?? fs.currentDirectory).path;
// find directories from argResults.rest
- final Set<String> directories = new Set<String>.from(argResults.rest
+ final Set<String> directories = Set<String>.from(argResults.rest
.map<String>((String path) => fs.path.canonicalize(path)));
if (directories.isNotEmpty) {
for (String directory in directories) {
@@ -54,7 +54,7 @@
if (argResults['flutter-repo']) {
// check for conflicting dependencies
- final PackageDependencyTracker dependencies = new PackageDependencyTracker();
+ final PackageDependencyTracker dependencies = PackageDependencyTracker();
dependencies.checkForConflictingDependencies(repoPackages, dependencies);
directories.addAll(repoRoots);
if (argResults.wasParsed('current-package') && argResults['current-package'])
@@ -68,12 +68,12 @@
throwToolExit('Nothing to analyze.', exitCode: 0);
// analyze all
- final Completer<Null> analysisCompleter = new Completer<Null>();
+ final Completer<Null> analysisCompleter = Completer<Null>();
final List<AnalysisError> errors = <AnalysisError>[];
final String sdkPath = argResults['dart-sdk'] ?? sdk.dartSdkPath;
- final AnalysisServer server = new AnalysisServer(
+ final AnalysisServer server = AnalysisServer(
sdkPath,
directories.toList(),
);
@@ -101,7 +101,7 @@
Cache.releaseLockEarly();
// collect results
- final Stopwatch timer = new Stopwatch()..start();
+ final Stopwatch timer = Stopwatch()..start();
final String message = directories.length > 1
? '${directories.length} ${directories.length == 1 ? 'directory' : 'directories'}'
: fs.path.basename(directories.first);
diff --git a/packages/flutter_tools/lib/src/commands/attach.dart b/packages/flutter_tools/lib/src/commands/attach.dart
index 09ad900..bcd8b24 100644
--- a/packages/flutter_tools/lib/src/commands/attach.dart
+++ b/packages/flutter_tools/lib/src/commands/attach.dart
@@ -53,7 +53,7 @@
help: 'Handle machine structured JSON command input and provide output\n'
'and progress in machine friendly format.',
);
- hotRunnerFactory ??= new HotRunnerFactory();
+ hotRunnerFactory ??= HotRunnerFactory();
}
HotRunnerFactory hotRunnerFactory;
@@ -93,15 +93,15 @@
final int devicePort = observatoryPort;
final Daemon daemon = argResults['machine']
- ? new Daemon(stdinCommandStream, stdoutCommandResponse,
- notifyingLogger: new NotifyingLogger(), logToStdout: true)
+ ? Daemon(stdinCommandStream, stdoutCommandResponse,
+ notifyingLogger: NotifyingLogger(), logToStdout: true)
: null;
Uri observatoryUri;
if (devicePort == null) {
ProtocolDiscovery observatoryDiscovery;
try {
- observatoryDiscovery = new ProtocolDiscovery.observatory(
+ observatoryDiscovery = ProtocolDiscovery.observatory(
device.getLogReader(),
portForwarder: device.portForwarder,
);
@@ -116,7 +116,7 @@
observatoryUri = Uri.parse('http://$ipv4Loopback:$localPort/');
}
try {
- final FlutterDevice flutterDevice = new FlutterDevice(
+ final FlutterDevice flutterDevice = FlutterDevice(
device,
trackWidgetCreation: false,
dillOutputPath: argResults['output-dill'],
@@ -127,7 +127,7 @@
final HotRunner hotRunner = hotRunnerFactory.build(
<FlutterDevice>[flutterDevice],
target: targetFile,
- debuggingOptions: new DebuggingOptions.enabled(getBuildInfo()),
+ debuggingOptions: DebuggingOptions.enabled(getBuildInfo()),
packagesFilePath: globalResults['packages'],
usesTerminalUI: daemon == null,
projectRootPath: argResults['project-root'],
@@ -170,7 +170,7 @@
String dillOutputPath,
bool stayResident = true,
bool ipv6 = false,
- }) => new HotRunner(
+ }) => HotRunner(
devices,
target: target,
debuggingOptions: debuggingOptions,
diff --git a/packages/flutter_tools/lib/src/commands/build.dart b/packages/flutter_tools/lib/src/commands/build.dart
index 5bf3990..eb5ab8e 100644
--- a/packages/flutter_tools/lib/src/commands/build.dart
+++ b/packages/flutter_tools/lib/src/commands/build.dart
@@ -18,11 +18,11 @@
class BuildCommand extends FlutterCommand {
BuildCommand({bool verboseHelp = false}) {
- addSubcommand(new BuildApkCommand(verboseHelp: verboseHelp));
- addSubcommand(new BuildAotCommand());
- addSubcommand(new BuildIOSCommand());
- addSubcommand(new BuildFlxCommand());
- addSubcommand(new BuildBundleCommand(verboseHelp: verboseHelp));
+ addSubcommand(BuildApkCommand(verboseHelp: verboseHelp));
+ addSubcommand(BuildAotCommand());
+ addSubcommand(BuildIOSCommand());
+ addSubcommand(BuildFlxCommand());
+ addSubcommand(BuildBundleCommand(verboseHelp: verboseHelp));
}
@override
diff --git a/packages/flutter_tools/lib/src/commands/build_aot.dart b/packages/flutter_tools/lib/src/commands/build_aot.dart
index 4f379a5..fb07c23 100644
--- a/packages/flutter_tools/lib/src/commands/build_aot.dart
+++ b/packages/flutter_tools/lib/src/commands/build_aot.dart
@@ -77,7 +77,7 @@
final String outputPath = argResults['output-dir'] ?? getAotBuildDirectory();
try {
String mainPath = findMainDartFile(targetFile);
- final AOTSnapshotter snapshotter = new AOTSnapshotter();
+ final AOTSnapshotter snapshotter = AOTSnapshotter();
// Compile to kernel.
mainPath = await snapshotter.compileKernel(
diff --git a/packages/flutter_tools/lib/src/commands/channel.dart b/packages/flutter_tools/lib/src/commands/channel.dart
index 6d14145..499fee1 100644
--- a/packages/flutter_tools/lib/src/commands/channel.dart
+++ b/packages/flutter_tools/lib/src/commands/channel.dart
@@ -39,7 +39,7 @@
case 1:
return _switchChannel(argResults.rest[0]);
default:
- throw new ToolExit('Too many arguments.\n$usage');
+ throw ToolExit('Too many arguments.\n$usage');
}
}
@@ -47,7 +47,7 @@
// Beware: currentBranch could contain PII. See getBranchName().
final String currentChannel = FlutterVersion.instance.channel;
final String currentBranch = FlutterVersion.instance.getBranchName();
- final Set<String> seenChannels = new Set<String>();
+ final Set<String> seenChannels = Set<String>();
showAll = showAll || currentChannel != currentBranch;
diff --git a/packages/flutter_tools/lib/src/commands/create.dart b/packages/flutter_tools/lib/src/commands/create.dart
index 4f9f440..a34ec89 100644
--- a/packages/flutter_tools/lib/src/commands/create.dart
+++ b/packages/flutter_tools/lib/src/commands/create.dart
@@ -360,7 +360,7 @@
}
int _renderTemplate(String templateName, Directory directory, Map<String, dynamic> context) {
- final Template template = new Template.fromName(templateName);
+ final Template template = Template.fromName(templateName);
return template.render(directory, context, overwriteExisting: false);
}
@@ -392,13 +392,13 @@
String _createUTIIdentifier(String organization, String name) {
// Create a UTI (https://en.wikipedia.org/wiki/Uniform_Type_Identifier) from a base name
- final RegExp disallowed = new RegExp(r'[^a-zA-Z0-9\-\.\u0080-\uffff]+');
+ final RegExp disallowed = RegExp(r'[^a-zA-Z0-9\-\.\u0080-\uffff]+');
name = camelCase(name).replaceAll(disallowed, '');
name = name.isEmpty ? 'untitled' : name;
return '$organization.$name';
}
-final Set<String> _packageDependencies = new Set<String>.from(<String>[
+final Set<String> _packageDependencies = Set<String>.from(<String>[
'analyzer',
'args',
'async',
@@ -431,7 +431,7 @@
/// we should disallow the project name.
String _validateProjectName(String projectName) {
if (!linter_utils.isValidPackageName(projectName)) {
- final String packageNameDetails = new package_names.PubPackageNames().details;
+ final String packageNameDetails = package_names.PubPackageNames().details;
return '"$projectName" is not a valid Dart package name.\n\n$packageNameDetails';
}
if (_packageDependencies.contains(projectName)) {
diff --git a/packages/flutter_tools/lib/src/commands/daemon.dart b/packages/flutter_tools/lib/src/commands/daemon.dart
index 5bb22bb..614f30a 100644
--- a/packages/flutter_tools/lib/src/commands/daemon.dart
+++ b/packages/flutter_tools/lib/src/commands/daemon.dart
@@ -52,13 +52,13 @@
Future<Null> runCommand() {
printStatus('Starting device daemon...');
- final NotifyingLogger notifyingLogger = new NotifyingLogger();
+ final NotifyingLogger notifyingLogger = NotifyingLogger();
Cache.releaseLockEarly();
return context.run<Null>(
body: () async {
- final Daemon daemon = new Daemon(
+ final Daemon daemon = Daemon(
stdinCommandStream, stdoutCommandResponse,
daemonCommand: this, notifyingLogger: notifyingLogger);
@@ -86,10 +86,10 @@
this.logToStdout = false,
}) {
// Set up domains.
- _registerDomain(daemonDomain = new DaemonDomain(this));
- _registerDomain(appDomain = new AppDomain(this));
- _registerDomain(deviceDomain = new DeviceDomain(this));
- _registerDomain(emulatorDomain = new EmulatorDomain(this));
+ _registerDomain(daemonDomain = DaemonDomain(this));
+ _registerDomain(appDomain = AppDomain(this));
+ _registerDomain(deviceDomain = DeviceDomain(this));
+ _registerDomain(emulatorDomain = EmulatorDomain(this));
// Start listening.
_commandSubscription = commandStream.listen(
@@ -112,7 +112,7 @@
final NotifyingLogger notifyingLogger;
final bool logToStdout;
- final Completer<int> _onExitCompleter = new Completer<int>();
+ final Completer<int> _onExitCompleter = Completer<int>();
final Map<String, Domain> _domainMap = <String, Domain>{};
void _registerDomain(Domain domain) {
@@ -184,7 +184,7 @@
String toString() => name;
void handleCommand(String command, dynamic id, Map<String, dynamic> args) {
- new Future<dynamic>.sync(() {
+ Future<dynamic>.sync(() {
if (_handlers.containsKey(command))
return _handlers[command](args);
throw 'command not understood: $name.$command';
@@ -289,12 +289,12 @@
StreamSubscription<LogMessage> _subscription;
Future<String> version(Map<String, dynamic> args) {
- return new Future<String>.value(protocolVersion);
+ return Future<String>.value(protocolVersion);
}
Future<Null> shutdown(Map<String, dynamic> args) {
Timer.run(daemon.shutdown);
- return new Future<Null>.value();
+ return Future<Null>.value();
}
@override
@@ -319,7 +319,7 @@
registerHandler('detach', detach);
}
- static final Uuid _uuidGenerator = new Uuid();
+ static final Uuid _uuidGenerator = Uuid();
static String _getNewAppId() => _uuidGenerator.generateV4();
@@ -343,7 +343,7 @@
final Directory cwd = fs.currentDirectory;
fs.currentDirectory = fs.directory(projectDirectory);
- final FlutterDevice flutterDevice = new FlutterDevice(
+ final FlutterDevice flutterDevice = FlutterDevice(
device,
trackWidgetCreation: trackWidgetCreation,
dillOutputPath: dillOutputPath,
@@ -352,7 +352,7 @@
ResidentRunner runner;
if (enableHotReload) {
- runner = new HotRunner(
+ runner = HotRunner(
<FlutterDevice>[flutterDevice],
target: target,
debuggingOptions: options,
@@ -365,7 +365,7 @@
hostIsIde: true,
);
} else {
- runner = new ColdRunner(
+ runner = ColdRunner(
<FlutterDevice>[flutterDevice],
target: target,
debuggingOptions: options,
@@ -395,7 +395,7 @@
String projectDirectory,
bool enableHotReload,
Directory cwd) async {
- final AppInstance app = new AppInstance(_getNewAppId(),
+ final AppInstance app = AppInstance(_getNewAppId(),
runner: runner, logToStdout: daemon.logToStdout);
_apps.add(app);
_sendAppEvent(app, 'start', <String, dynamic>{
@@ -407,7 +407,7 @@
Completer<DebugConnectionInfo> connectionInfoCompleter;
if (runner.debuggingOptions.debuggingEnabled) {
- connectionInfoCompleter = new Completer<DebugConnectionInfo>();
+ connectionInfoCompleter = Completer<DebugConnectionInfo>();
// We don't want to wait for this future to complete and callbacks won't fail.
// As it just writes to stdout.
connectionInfoCompleter.future.then<Null>((DebugConnectionInfo info) { // ignore: unawaited_futures
@@ -420,7 +420,7 @@
_sendAppEvent(app, 'debugPort', params);
});
}
- final Completer<void> appStartedCompleter = new Completer<void>();
+ final Completer<void> appStartedCompleter = Completer<void>();
// We don't want to wait for this future to complete and callbacks won't fail.
// As it just writes to stdout.
appStartedCompleter.future.timeout(const Duration(minutes: 1), onTimeout: () { // ignore: unawaited_futures
@@ -565,10 +565,10 @@
registerHandler('forward', forward);
registerHandler('unforward', unforward);
- addDeviceDiscoverer(new AndroidDevices());
- addDeviceDiscoverer(new IOSDevices());
- addDeviceDiscoverer(new IOSSimulators());
- addDeviceDiscoverer(new FlutterTesterDevices());
+ addDeviceDiscoverer(AndroidDevices());
+ addDeviceDiscoverer(IOSDevices());
+ addDeviceDiscoverer(IOSSimulators());
+ addDeviceDiscoverer(FlutterTesterDevices());
}
void addDeviceDiscoverer(PollingDeviceDiscovery discoverer) {
@@ -596,7 +596,7 @@
discoverer.onRemoved.listen(_onDeviceEvent('device.removed'));
}
- Future<Null> _serializeDeviceEvents = new Future<Null>.value();
+ Future<Null> _serializeDeviceEvents = Future<Null>.value();
_DeviceEventHandler _onDeviceEvent(String eventName) {
return (Device device) {
@@ -620,14 +620,14 @@
Future<Null> enable(Map<String, dynamic> args) {
for (PollingDeviceDiscovery discoverer in _discoverers)
discoverer.startPolling();
- return new Future<Null>.value();
+ return Future<Null>.value();
}
/// Disable device events.
Future<Null> disable(Map<String, dynamic> args) {
for (PollingDeviceDiscovery discoverer in _discoverers)
discoverer.stopPolling();
- return new Future<Null>.value();
+ return Future<Null>.value();
}
/// Forward a host port to a device port.
@@ -655,7 +655,7 @@
if (device == null)
throw "device '$deviceId' not found";
- return device.portForwarder.unforward(new ForwardedPort(hostPort, devicePort));
+ return device.portForwarder.unforward(ForwardedPort(hostPort, devicePort));
}
@override
@@ -739,13 +739,13 @@
}
class NotifyingLogger extends Logger {
- final StreamController<LogMessage> _messageController = new StreamController<LogMessage>.broadcast();
+ final StreamController<LogMessage> _messageController = StreamController<LogMessage>.broadcast();
Stream<LogMessage> get onMessage => _messageController.stream;
@override
void printError(String message, { StackTrace stackTrace, bool emphasis = false }) {
- _messageController.add(new LogMessage('error', message, stackTrace));
+ _messageController.add(LogMessage('error', message, stackTrace));
}
@override
@@ -753,7 +753,7 @@
String message,
{ bool emphasis = false, bool newline = true, String ansiAlternative, int indent }
) {
- _messageController.add(new LogMessage('status', message));
+ _messageController.add(LogMessage('status', message));
}
@override
@@ -769,7 +769,7 @@
int progressIndicatorPadding = kDefaultStatusPadding,
}) {
printStatus(message);
- return new Status();
+ return Status();
}
void dispose() {
@@ -799,7 +799,7 @@
}
Future<T> _runInZone<T>(AppDomain domain, dynamic method()) {
- _logger ??= new _AppRunLogger(domain, this, parent: logToStdout ? logger : null);
+ _logger ??= _AppRunLogger(domain, this, parent: logToStdout ? logger : null);
return context.run<T>(
body: method,
@@ -812,7 +812,7 @@
/// This domain responds to methods like [getEmulators] and [launch].
class EmulatorDomain extends Domain {
- EmulatorManager emulators = new EmulatorManager();
+ EmulatorManager emulators = EmulatorManager();
EmulatorDomain(Daemon daemon) : super(daemon, 'emulator') {
registerHandler('getEmulators', getEmulators);
@@ -924,7 +924,7 @@
'message': message,
});
- _status = new Status(onFinish: () {
+ _status = Status(onFinish: () {
_status = null;
_sendProgressEvent(<String, dynamic>{
'id': id.toString(),
diff --git a/packages/flutter_tools/lib/src/commands/doctor.dart b/packages/flutter_tools/lib/src/commands/doctor.dart
index 0dd0b80..4010476 100644
--- a/packages/flutter_tools/lib/src/commands/doctor.dart
+++ b/packages/flutter_tools/lib/src/commands/doctor.dart
@@ -27,6 +27,6 @@
@override
Future<FlutterCommandResult> runCommand() async {
final bool success = await doctor.diagnose(androidLicenses: argResults['android-licenses'], verbose: verbose);
- return new FlutterCommandResult(success ? ExitStatus.success : ExitStatus.warning);
+ return FlutterCommandResult(success ? ExitStatus.success : ExitStatus.warning);
}
}
diff --git a/packages/flutter_tools/lib/src/commands/drive.dart b/packages/flutter_tools/lib/src/commands/drive.dart
index 0d7b529..61f8d11 100644
--- a/packages/flutter_tools/lib/src/commands/drive.dart
+++ b/packages/flutter_tools/lib/src/commands/drive.dart
@@ -254,7 +254,7 @@
package,
mainPath: mainPath,
route: command.route,
- debuggingOptions: new DebuggingOptions.enabled(
+ debuggingOptions: DebuggingOptions.enabled(
command.getBuildInfo(),
startPaused: true,
observatoryPort: command.observatoryPort,
diff --git a/packages/flutter_tools/lib/src/commands/fuchsia_reload.dart b/packages/flutter_tools/lib/src/commands/fuchsia_reload.dart
index 317960e..10ed98a 100644
--- a/packages/flutter_tools/lib/src/commands/fuchsia_reload.dart
+++ b/packages/flutter_tools/lib/src/commands/fuchsia_reload.dart
@@ -128,16 +128,16 @@
final List<Uri> observatoryUris = fullAddresses.map(
(String a) => Uri.parse('http://$a')
).toList();
- final FuchsiaDevice device = new FuchsiaDevice(
+ final FuchsiaDevice device = FuchsiaDevice(
fullAddresses[0], name: _address);
- final FlutterDevice flutterDevice = new FlutterDevice(
+ final FlutterDevice flutterDevice = FlutterDevice(
device,
trackWidgetCreation: false,
);
flutterDevice.observatoryUris = observatoryUris;
- final HotRunner hotRunner = new HotRunner(
+ final HotRunner hotRunner = HotRunner(
<FlutterDevice>[flutterDevice],
- debuggingOptions: new DebuggingOptions.enabled(getBuildInfo()),
+ debuggingOptions: DebuggingOptions.enabled(getBuildInfo()),
target: _target,
projectRootPath: _fuchsiaProjectPath,
packagesFilePath: _dotPackagesPath
@@ -150,7 +150,7 @@
}
// A cache of VMService connections.
- final HashMap<int, VMService> _vmServiceCache = new HashMap<int, VMService>();
+ final HashMap<int, VMService> _vmServiceCache = HashMap<int, VMService>();
Future<VMService> _getVMService(int port) async {
if (!_vmServiceCache.containsKey(port)) {
@@ -217,7 +217,7 @@
final String external = getSizeAsMB(totalExternal);
final String tabs = '\t' * tabDepth;
final String extraTabs = '\t' * (tabDepth + 1);
- final StringBuffer stringBuffer = new StringBuffer(
+ final StringBuffer stringBuffer = StringBuffer(
'$tabs$_bold$embedder at $addr$_reset\n'
'${extraTabs}RSS: $maxRSS\n'
'${extraTabs}Native allocations: $heapSize\n'
@@ -372,7 +372,7 @@
Future<List<int>> _getServicePorts() async {
final FuchsiaDeviceCommandRunner runner =
- new FuchsiaDeviceCommandRunner(_address, _buildDir);
+ FuchsiaDeviceCommandRunner(_address, _buildDir);
final List<String> lsOutput = await runner.run('ls /tmp/dart.services');
final List<int> ports = <int>[];
if (lsOutput != null) {
@@ -427,7 +427,7 @@
if (localPort == 0) {
printStatus(
'_PortForwarder failed to find a local port for $address:$remotePort');
- return new _PortForwarder._(null, 0, 0, null, null);
+ return _PortForwarder._(null, 0, 0, null, null);
}
const String dummyRemoteCommand = 'date';
final List<String> command = <String>[
@@ -444,7 +444,7 @@
printTrace("'${command.join(' ')}' exited with exit code $c");
});
printTrace('Set up forwarding from $localPort to $address:$remotePort');
- return new _PortForwarder._(address, remotePort, localPort, process, sshConfig);
+ return _PortForwarder._(address, remotePort, localPort, process, sshConfig);
}
Future<Null> stop() async {
diff --git a/packages/flutter_tools/lib/src/commands/ide_config.dart b/packages/flutter_tools/lib/src/commands/ide_config.dart
index 1123cbd..415555c 100644
--- a/packages/flutter_tools/lib/src/commands/ide_config.dart
+++ b/packages/flutter_tools/lib/src/commands/ide_config.dart
@@ -121,7 +121,7 @@
return;
}
- final Set<String> manifest = new Set<String>();
+ final Set<String> manifest = Set<String>();
final List<FileSystemEntity> flutterFiles = _flutterRoot.listSync(recursive: true);
for (FileSystemEntity entity in flutterFiles) {
final String relativePath = fs.path.relative(entity.path, from: _flutterRoot.absolute.path);
@@ -139,7 +139,7 @@
}
// Skip files we aren't interested in.
- final RegExp _trackedIdeaFileRegExp = new RegExp(
+ final RegExp _trackedIdeaFileRegExp = RegExp(
r'(\.name|modules.xml|vcs.xml)$',
);
final bool isATrackedIdeaFile = _hasDirectoryInPath(srcFile, '.idea') &&
@@ -253,7 +253,7 @@
}
int _renderTemplate(String templateName, String dirPath, Map<String, dynamic> context) {
- final Template template = new Template(_templateDirectory, _templateDirectory);
+ final Template template = Template(_templateDirectory, _templateDirectory);
return template.render(
fs.directory(dirPath),
context,
diff --git a/packages/flutter_tools/lib/src/commands/logs.dart b/packages/flutter_tools/lib/src/commands/logs.dart
index a16b23f..56212ad 100644
--- a/packages/flutter_tools/lib/src/commands/logs.dart
+++ b/packages/flutter_tools/lib/src/commands/logs.dart
@@ -47,7 +47,7 @@
printStatus('Showing $logReader logs:');
- final Completer<int> exitCompleter = new Completer<int>();
+ final Completer<int> exitCompleter = Completer<int>();
// Start reading.
final StreamSubscription<String> subscription = logReader.logLines.listen(
diff --git a/packages/flutter_tools/lib/src/commands/materialize.dart b/packages/flutter_tools/lib/src/commands/materialize.dart
index 0c0f27d..c785ea4 100644
--- a/packages/flutter_tools/lib/src/commands/materialize.dart
+++ b/packages/flutter_tools/lib/src/commands/materialize.dart
@@ -10,8 +10,8 @@
class MaterializeCommand extends FlutterCommand {
MaterializeCommand() {
- addSubcommand(new MaterializeAndroidCommand());
- addSubcommand(new MaterializeIosCommand());
+ addSubcommand(MaterializeAndroidCommand());
+ addSubcommand(MaterializeIosCommand());
}
@override
@@ -45,7 +45,7 @@
await super.validateCommand();
_project = await FlutterProject.current();
if (!_project.isModule)
- throw new ToolExit("Only projects created using 'flutter create -t module' can be materialized.");
+ throw ToolExit("Only projects created using 'flutter create -t module' can be materialized.");
}
}
diff --git a/packages/flutter_tools/lib/src/commands/packages.dart b/packages/flutter_tools/lib/src/commands/packages.dart
index b78e25b..e010a35 100644
--- a/packages/flutter_tools/lib/src/commands/packages.dart
+++ b/packages/flutter_tools/lib/src/commands/packages.dart
@@ -12,10 +12,10 @@
class PackagesCommand extends FlutterCommand {
PackagesCommand() {
- addSubcommand(new PackagesGetCommand('get', false));
- addSubcommand(new PackagesGetCommand('upgrade', true));
- addSubcommand(new PackagesTestCommand());
- addSubcommand(new PackagesPassthroughCommand());
+ addSubcommand(PackagesGetCommand('get', false));
+ addSubcommand(PackagesGetCommand('upgrade', true));
+ addSubcommand(PackagesTestCommand());
+ addSubcommand(PackagesPassthroughCommand());
}
@override
diff --git a/packages/flutter_tools/lib/src/commands/run.dart b/packages/flutter_tools/lib/src/commands/run.dart
index 9f6891e..3443010 100644
--- a/packages/flutter_tools/lib/src/commands/run.dart
+++ b/packages/flutter_tools/lib/src/commands/run.dart
@@ -244,9 +244,9 @@
DebuggingOptions _createDebuggingOptions() {
final BuildInfo buildInfo = getBuildInfo();
if (buildInfo.isRelease) {
- return new DebuggingOptions.disabled(buildInfo);
+ return DebuggingOptions.disabled(buildInfo);
} else {
- return new DebuggingOptions.enabled(
+ return DebuggingOptions.enabled(
buildInfo,
startPaused: argResults['start-paused'],
useTestFonts: argResults['use-test-fonts'],
@@ -269,8 +269,8 @@
if (argResults['machine']) {
if (devices.length > 1)
throwToolExit('--machine does not support -d all.');
- final Daemon daemon = new Daemon(stdinCommandStream, stdoutCommandResponse,
- notifyingLogger: new NotifyingLogger(), logToStdout: true);
+ final Daemon daemon = Daemon(stdinCommandStream, stdoutCommandResponse,
+ notifyingLogger: NotifyingLogger(), logToStdout: true);
AppInstance app;
try {
final String applicationBinaryPath = argResults['use-application-binary'];
@@ -293,7 +293,7 @@
final int result = await app.runner.waitForAppToFinish();
if (result != 0)
throwToolExit(null, exitCode: result);
- return new FlutterCommandResult(
+ return FlutterCommandResult(
ExitStatus.success,
timingLabelParts: <String>['daemon'],
endTimeOverride: appStartedTime,
@@ -337,7 +337,7 @@
}
final List<FlutterDevice> flutterDevices = devices.map((Device device) {
- return new FlutterDevice(
+ return FlutterDevice(
device,
trackWidgetCreation: argResults['track-widget-creation'],
dillOutputPath: argResults['output-dill'],
@@ -349,7 +349,7 @@
ResidentRunner runner;
final String applicationBinaryPath = argResults['use-application-binary'];
if (hotMode) {
- runner = new HotRunner(
+ runner = HotRunner(
flutterDevices,
target: targetFile,
debuggingOptions: _createDebuggingOptions(),
@@ -364,7 +364,7 @@
ipv6: ipv6,
);
} else {
- runner = new ColdRunner(
+ runner = ColdRunner(
flutterDevices,
target: targetFile,
debuggingOptions: _createDebuggingOptions(),
@@ -382,7 +382,7 @@
// need to know about analytics.
//
// Do not add more operations to the future.
- final Completer<void> appStartedTimeRecorder = new Completer<void>.sync();
+ final Completer<void> appStartedTimeRecorder = Completer<void>.sync();
// This callback can't throw.
appStartedTimeRecorder.future.then( // ignore: unawaited_futures
(_) { appStartedTime = clock.now(); }
@@ -395,7 +395,7 @@
);
if (result != 0)
throwToolExit(null, exitCode: result);
- return new FlutterCommandResult(
+ return FlutterCommandResult(
ExitStatus.success,
timingLabelParts: <String>[
hotMode ? 'hot' : 'cold',
diff --git a/packages/flutter_tools/lib/src/commands/screenshot.dart b/packages/flutter_tools/lib/src/commands/screenshot.dart
index c4233d7..be39b24 100644
--- a/packages/flutter_tools/lib/src/commands/screenshot.dart
+++ b/packages/flutter_tools/lib/src/commands/screenshot.dart
@@ -122,7 +122,7 @@
}
Future<Map<String, dynamic>> _invokeVmServiceRpc(String method) async {
- final Uri observatoryUri = new Uri(scheme: 'http', host: '127.0.0.1',
+ final Uri observatoryUri = Uri(scheme: 'http', host: '127.0.0.1',
port: int.parse(argResults[_kObservatoryPort]));
final VMService vmService = await VMService.connect(observatoryUri);
return await vmService.vm.invokeRpcRaw(method);
diff --git a/packages/flutter_tools/lib/src/commands/test.dart b/packages/flutter_tools/lib/src/commands/test.dart
index 170f7e8..4fc19e9 100644
--- a/packages/flutter_tools/lib/src/commands/test.dart
+++ b/packages/flutter_tools/lib/src/commands/test.dart
@@ -140,7 +140,7 @@
CoverageCollector collector;
if (argResults['coverage'] || argResults['merge-coverage']) {
- collector = new CoverageCollector();
+ collector = CoverageCollector();
}
final bool machine = argResults['machine'];
@@ -152,7 +152,7 @@
if (collector != null) {
watcher = collector;
} else if (machine) {
- watcher = new EventPrinter();
+ watcher = EventPrinter();
}
Cache.releaseLockEarly();
diff --git a/packages/flutter_tools/lib/src/commands/trace.dart b/packages/flutter_tools/lib/src/commands/trace.dart
index 3999a5b..0b5d44e 100644
--- a/packages/flutter_tools/lib/src/commands/trace.dart
+++ b/packages/flutter_tools/lib/src/commands/trace.dart
@@ -64,7 +64,7 @@
Duration duration;
if (argResults.wasParsed('duration')) {
try {
- duration = new Duration(seconds: int.parse(argResults['duration']));
+ duration = Duration(seconds: int.parse(argResults['duration']));
} on FormatException {
throwToolExit('Invalid duration passed to --duration; it should be a positive number of seconds.');
}
@@ -88,7 +88,7 @@
if (start)
await tracing.startTracing();
- await new Future<Null>.delayed(duration);
+ await Future<Null>.delayed(duration);
if (stop)
await _stopTracing(tracing);
}
diff --git a/packages/flutter_tools/lib/src/commands/update_packages.dart b/packages/flutter_tools/lib/src/commands/update_packages.dart
index 6f19cc2..c6e988a 100644
--- a/packages/flutter_tools/lib/src/commands/update_packages.dart
+++ b/packages/flutter_tools/lib/src/commands/update_packages.dart
@@ -112,7 +112,7 @@
// package that is in the goldens repository. We need to make sure that the goldens
// repository is cloned locally before we verify or update pubspecs.
printStatus('Cloning goldens repository...');
- final GoldensClient goldensClient = new GoldensClient();
+ final GoldensClient goldensClient = GoldensClient();
await goldensClient.prepare();
if (isVerifyOnly) {
@@ -121,7 +121,7 @@
for (Directory directory in packages) {
PubspecYaml pubspec;
try {
- pubspec = new PubspecYaml(directory);
+ pubspec = PubspecYaml(directory);
} on String catch (message) {
throwToolExit(message);
}
@@ -176,12 +176,12 @@
// First, collect up the explicit dependencies:
final List<PubspecYaml> pubspecs = <PubspecYaml>[];
final Map<String, PubspecDependency> dependencies = <String, PubspecDependency>{};
- final Set<String> specialDependencies = new Set<String>();
+ final Set<String> specialDependencies = Set<String>();
for (Directory directory in packages) { // these are all the directories with pubspec.yamls we care about
printTrace('Reading pubspec.yaml from: ${directory.path}');
PubspecYaml pubspec;
try {
- pubspec = new PubspecYaml(directory); // this parses the pubspec.yaml
+ pubspec = PubspecYaml(directory); // this parses the pubspec.yaml
} on String catch (message) {
throwToolExit(message);
}
@@ -222,7 +222,7 @@
// going to create a fake package and then run "pub upgrade" on it. The
// pub tool will attempt to bring these dependencies up to the most recent
// possible versions while honoring all their constraints.
- final PubDependencyTree tree = new PubDependencyTree(); // object to collect results
+ final PubDependencyTree tree = PubDependencyTree(); // object to collect results
final Directory tempDir = fs.systemTempDirectory.createTempSync('flutter_update_packages.');
try {
final File fakePackage = _pubspecFor(tempDir);
@@ -255,7 +255,7 @@
for (PubspecDependency dependency in pubspec.dependencies) {
if (dependency.kind == DependencyKind.normal) {
tree._versions[package] = version;
- tree._dependencyTree[package] ??= new Set<String>();
+ tree._dependencyTree[package] ??= Set<String>();
tree._dependencyTree[package].add(dependency.name);
}
}
@@ -290,7 +290,7 @@
// the regular code path.
}
- final Stopwatch timer = new Stopwatch()..start();
+ final Stopwatch timer = Stopwatch()..start();
int count = 0;
for (Directory dir in packages) {
@@ -314,11 +314,11 @@
if (!tree.contains(to))
throwToolExit('Package $to not found in the dependency tree.');
- final Queue<_DependencyLink> traversalQueue = new Queue<_DependencyLink>();
- final Set<String> visited = new Set<String>();
+ final Queue<_DependencyLink> traversalQueue = Queue<_DependencyLink>();
+ final Set<String> visited = Set<String>();
final List<_DependencyLink> paths = <_DependencyLink>[];
- traversalQueue.addFirst(new _DependencyLink(from: null, to: from));
+ traversalQueue.addFirst(_DependencyLink(from: null, to: from));
while (traversalQueue.isNotEmpty) {
final _DependencyLink link = traversalQueue.removeLast();
if (link.to == to)
@@ -327,13 +327,13 @@
visited.add(link.from.to);
for (String dependency in tree._dependencyTree[link.to]) {
if (!visited.contains(dependency)) {
- traversalQueue.addFirst(new _DependencyLink(from: link, to: dependency));
+ traversalQueue.addFirst(_DependencyLink(from: link, to: dependency));
}
}
}
for (_DependencyLink path in paths) {
- final StringBuffer buf = new StringBuffer();
+ final StringBuffer buf = StringBuffer();
while (path != null) {
buf.write('${path.to}');
path = path.from;
@@ -490,7 +490,7 @@
} else {
// This line isn't a section header, and we're not in a section we care about.
// We just stick the line into the output unmodified.
- result.add(new PubspecLine(line));
+ result.add(PubspecLine(line));
}
} else {
// We're in a section we care about. Try to parse out the dependency:
@@ -531,7 +531,7 @@
// We're in a section we care about but got a line we didn't
// recognize. Maybe it's a comment or a blank line or something.
// Just pass it through.
- result.add(new PubspecLine(line));
+ result.add(PubspecLine(line));
}
}
} else {
@@ -555,15 +555,15 @@
// Remove the PubspecDependency entry we had for it and replace it
// with a PubspecLine entry, and add such an entry for this line.
result.removeLast();
- result.add(new PubspecLine(lastDependency.line));
- result.add(new PubspecLine(line));
+ result.add(PubspecLine(lastDependency.line));
+ result.add(PubspecLine(line));
}
// We're done with this special dependency, so reset back to null so
// we'll go in the top section next time instead.
lastDependency = null;
}
}
- return new PubspecYaml._(file, packageName, packageVersion, result, checksum ?? new PubspecChecksum(null, ''));
+ return PubspecYaml._(file, packageName, packageVersion, result, checksum ?? PubspecChecksum(null, ''));
}
/// This returns all the explicit dependencies that this pubspec.yaml lists under dependencies.
@@ -594,8 +594,8 @@
void apply(PubDependencyTree versions, Set<String> specialDependencies) {
assert(versions != null);
final List<String> output = <String>[]; // the string data to output to the file, line by line
- final Set<String> directDependencies = new Set<String>(); // packages this pubspec directly depends on (i.e. not transitive)
- final Set<String> devDependencies = new Set<String>();
+ final Set<String> directDependencies = Set<String>(); // packages this pubspec directly depends on (i.e. not transitive)
+ final Set<String> devDependencies = Set<String>();
Section section = Section.other; // the section we're currently handling
// the line number where we're going to insert the transitive dependencies.
@@ -693,19 +693,19 @@
final List<String> transitiveDevDependencyOutput = <String>[];
// Which dependencies we need to handle for the transitive and dev dependency sections.
- final Set<String> transitiveDependencies = new Set<String>();
- final Set<String> transitiveDevDependencies = new Set<String>();
+ final Set<String> transitiveDependencies = Set<String>();
+ final Set<String> transitiveDevDependencies = Set<String>();
// Merge the lists of dependencies we've seen in this file from dependencies, dev dependencies,
// and the dependencies we know this file mentions that are already pinned
// (and which didn't get special processing above).
- final Set<String> implied = new Set<String>.from(directDependencies)
+ final Set<String> implied = Set<String>.from(directDependencies)
..addAll(specialDependencies)
..addAll(devDependencies);
// Create a new set to hold the list of packages we've already processed, so
// that we don't redundantly process them multiple times.
- final Set<String> done = new Set<String>();
+ final Set<String> done = Set<String>();
for (String package in directDependencies)
transitiveDependencies.addAll(versions.getTransitiveDependenciesFor(package, seen: done, exclude: implied));
for (String package in devDependencies)
@@ -722,7 +722,7 @@
transitiveDevDependencyOutput.add(' $package: ${versions.versionFor(package)} $kTransitiveMagicString');
// Build a sorted list of all dependencies for the checksum.
- final Set<String> checksumDependencies = new Set<String>()
+ final Set<String> checksumDependencies = Set<String>()
..addAll(directDependencies)
..addAll(devDependencies)
..addAll(transitiveDependenciesAsList)
@@ -755,7 +755,7 @@
// Output the result to the pubspec.yaml file, skipping leading and
// duplicate blank lines and removing trailing spaces.
- final StringBuffer contents = new StringBuffer();
+ final StringBuffer contents = StringBuffer();
bool hadBlankLine = true;
for (String line in output) {
line = line.trimRight();
@@ -799,8 +799,8 @@
static PubspecChecksum parse(String line) {
final List<String> tokens = line.split(kDependencyChecksum);
if (tokens.length != 2)
- return new PubspecChecksum(null, line);
- return new PubspecChecksum(tokens.last.trim(), line);
+ return PubspecChecksum(null, line);
+ return PubspecChecksum(tokens.last.trim(), line);
}
}
@@ -852,16 +852,16 @@
final String value = parts.last.trim();
switch (sectionName) {
case 'dependencies':
- return new PubspecHeader(line, Section.dependencies);
+ return PubspecHeader(line, Section.dependencies);
case 'dev_dependencies':
- return new PubspecHeader(line, Section.devDependencies);
+ return PubspecHeader(line, Section.devDependencies);
case 'dependency_overrides':
- return new PubspecHeader(line, Section.dependencyOverrides);
+ return PubspecHeader(line, Section.dependencyOverrides);
case 'name':
case 'version':
- return new PubspecHeader(line, Section.header, name: sectionName, value: value);
+ return PubspecHeader(line, Section.header, name: sectionName, value: value);
default:
- return new PubspecHeader(line, Section.other);
+ return PubspecHeader(line, Section.other);
}
}
@@ -930,7 +930,7 @@
if (colonIndex != -1) {
version = line.substring(colonIndex + 1, hashIndex != -1 ? hashIndex : line.length).trim();
}
- return new PubspecDependency(line, package, suffix, isTransitive: isTransitive, version: version, kind: stripped.isEmpty ? DependencyKind.unknown : DependencyKind.normal, sourcePath: filename);
+ return PubspecDependency(line, package, suffix, isTransitive: isTransitive, version: version, kind: stripped.isEmpty ? DependencyKind.unknown : DependencyKind.normal, sourcePath: filename);
}
final String name; // the package name
@@ -1066,8 +1066,8 @@
/// Generates the source of a fake pubspec.yaml file given a list of
/// dependencies.
String _generateFakePubspec(Iterable<PubspecDependency> dependencies) {
- final StringBuffer result = new StringBuffer();
- final StringBuffer overrides = new StringBuffer();
+ final StringBuffer result = StringBuffer();
+ final StringBuffer overrides = StringBuffer();
result.writeln('name: flutter_update_packages');
result.writeln('dependencies:');
overrides.writeln('dependency_overrides:');
@@ -1145,7 +1145,7 @@
dependencies = const <String>[];
}
_versions[package] = version;
- _dependencyTree[package] = new Set<String>.from(dependencies);
+ _dependencyTree[package] = Set<String>.from(dependencies);
}
}
return null;
diff --git a/packages/flutter_tools/lib/src/commands/upgrade.dart b/packages/flutter_tools/lib/src/commands/upgrade.dart
index d6a1e82..eefa606 100644
--- a/packages/flutter_tools/lib/src/commands/upgrade.dart
+++ b/packages/flutter_tools/lib/src/commands/upgrade.dart
@@ -88,12 +88,12 @@
}
// dev/benchmarks/complex_layout/lib/main.dart | 24 +-
- static final RegExp _gitDiffRegex = new RegExp(r' (\S+)\s+\|\s+\d+ [+-]+');
+ static final RegExp _gitDiffRegex = RegExp(r' (\S+)\s+\|\s+\d+ [+-]+');
// rename {packages/flutter/doc => dev/docs}/styles.html (92%)
// delete mode 100644 doc/index.html
// create mode 100644 examples/flutter_gallery/lib/gallery/demo.dart
- static final RegExp _gitChangedRegex = new RegExp(r' (rename|delete mode|create mode) .+');
+ static final RegExp _gitChangedRegex = RegExp(r' (rename|delete mode|create mode) .+');
@visibleForTesting
static bool matchesGitLine(String line) {
diff --git a/packages/flutter_tools/lib/src/compile.dart b/packages/flutter_tools/lib/src/compile.dart
index 7f37282..ff1f3e7 100644
--- a/packages/flutter_tools/lib/src/compile.dart
+++ b/packages/flutter_tools/lib/src/compile.dart
@@ -49,7 +49,7 @@
}
final int spaceDelimiter = string.lastIndexOf(' ');
compilerOutput.complete(
- new CompilerOutput(
+ CompilerOutput(
string.substring(boundaryKey.length + 1, spaceDelimiter),
int.parse(string.substring(spaceDelimiter + 1).trim())));
}
@@ -62,7 +62,7 @@
// with its own boundary key and new completer.
void reset({bool suppressCompilerMessages = false}) {
boundaryKey = null;
- compilerOutput = new Completer<CompilerOutput>();
+ compilerOutput = Completer<CompilerOutput>();
_suppressCompilerMessages = suppressCompilerMessages;
}
}
@@ -95,7 +95,7 @@
// depfile. None of these are available on the local host.
Fingerprinter fingerprinter;
if (depFilePath != null) {
- fingerprinter = new Fingerprinter(
+ fingerprinter = Fingerprinter(
fingerprintPath: '$depFilePath.fingerprint',
paths: <String>[mainPath],
properties: <String, String>{
@@ -109,7 +109,7 @@
if (await fingerprinter.doesFingerprintMatch()) {
printTrace('Skipping kernel compilation. Fingerprint match.');
- return new CompilerOutput(outputFilePath, 0);
+ return CompilerOutput(outputFilePath, 0);
}
}
@@ -175,7 +175,7 @@
printError('Failed to start frontend server $error, $stack');
});
- final _StdoutHandler _stdoutHandler = new _StdoutHandler();
+ final _StdoutHandler _stdoutHandler = _StdoutHandler();
server.stderr
.transform(utf8.decoder)
@@ -255,8 +255,8 @@
_packagesPath = packagesPath,
_fileSystemRoots = fileSystemRoots,
_fileSystemScheme = fileSystemScheme,
- _stdoutHandler = new _StdoutHandler(consumer: compilerMessageConsumer),
- _controller = new StreamController<_CompilationRequest>(),
+ _stdoutHandler = _StdoutHandler(consumer: compilerMessageConsumer),
+ _controller = StreamController<_CompilationRequest>(),
_initializeFromDill = initializeFromDill {
// This is a URI, not a file path, so the forward slash is correct even on Windows.
if (!_sdkRoot.endsWith('/'))
@@ -287,9 +287,9 @@
_controller.stream.listen(_handleCompilationRequest);
}
- final Completer<CompilerOutput> completer = new Completer<CompilerOutput>();
+ final Completer<CompilerOutput> completer = Completer<CompilerOutput>();
_controller.add(
- new _RecompileRequest(completer, mainPath, invalidatedFiles, outputPath, packagesFilePath)
+ _RecompileRequest(completer, mainPath, invalidatedFiles, outputPath, packagesFilePath)
);
return completer.future;
}
@@ -304,7 +304,7 @@
request.outputPath, _mapFilename(request.packagesFilePath));
}
- final String inputKey = new Uuid().generateV4();
+ final String inputKey = Uuid().generateV4();
_server.stdin.writeln('recompile ${request.mainPath != null ? _mapFilename(request.mainPath) + " ": ""}$inputKey');
for (String fileUri in request.invalidatedFiles) {
_server.stdin.writeln(_mapFileUri(fileUri));
@@ -399,9 +399,9 @@
_controller.stream.listen(_handleCompilationRequest);
}
- final Completer<CompilerOutput> completer = new Completer<CompilerOutput>();
+ final Completer<CompilerOutput> completer = Completer<CompilerOutput>();
_controller.add(
- new _CompileExpressionRequest(
+ _CompileExpressionRequest(
completer, expression, definitions, typeDefinitions, libraryUri, klass, isStatic)
);
return completer.future;
@@ -416,7 +416,7 @@
if (_server == null)
return null;
- final String inputKey = new Uuid().generateV4();
+ final String inputKey = Uuid().generateV4();
_server.stdin.writeln('compile-expression $inputKey');
_server.stdin.writeln(request.expression);
request.definitions?.forEach(_server.stdin.writeln);
@@ -455,7 +455,7 @@
if (_fileSystemRoots != null) {
for (String root in _fileSystemRoots) {
if (filename.startsWith(root)) {
- return new Uri(
+ return Uri(
scheme: _fileSystemScheme, path: filename.substring(root.length))
.toString();
}
@@ -469,7 +469,7 @@
final String filename = Uri.parse(fileUri).toFilePath();
for (String root in _fileSystemRoots) {
if (filename.startsWith(root)) {
- return new Uri(
+ return Uri(
scheme: _fileSystemScheme, path: filename.substring(root.length))
.toString();
}
diff --git a/packages/flutter_tools/lib/src/context_runner.dart b/packages/flutter_tools/lib/src/context_runner.dart
index 6a01414..86c8ab5 100644
--- a/packages/flutter_tools/lib/src/context_runner.dart
+++ b/packages/flutter_tools/lib/src/context_runner.dart
@@ -46,36 +46,36 @@
fallbacks: <Type, Generator>{
AndroidSdk: AndroidSdk.locateAndroidSdk,
AndroidStudio: AndroidStudio.latestValid,
- AndroidWorkflow: () => new AndroidWorkflow(),
- AndroidValidator: () => new AndroidValidator(),
- Artifacts: () => new CachedArtifacts(),
+ AndroidWorkflow: () => AndroidWorkflow(),
+ AndroidValidator: () => AndroidValidator(),
+ Artifacts: () => CachedArtifacts(),
AssetBundleFactory: () => AssetBundleFactory.defaultInstance,
BotDetector: () => const BotDetector(),
- Cache: () => new Cache(),
+ Cache: () => Cache(),
Clock: () => const Clock(),
- CocoaPods: () => new CocoaPods(),
- Config: () => new Config(),
- DevFSConfig: () => new DevFSConfig(),
- DeviceManager: () => new DeviceManager(),
+ CocoaPods: () => CocoaPods(),
+ Config: () => Config(),
+ DevFSConfig: () => DevFSConfig(),
+ DeviceManager: () => DeviceManager(),
Doctor: () => const Doctor(),
DoctorValidatorsProvider: () => DoctorValidatorsProvider.defaultInstance,
- EmulatorManager: () => new EmulatorManager(),
+ EmulatorManager: () => EmulatorManager(),
Flags: () => const EmptyFlags(),
- FlutterVersion: () => new FlutterVersion(const Clock()),
+ FlutterVersion: () => FlutterVersion(const Clock()),
GenSnapshot: () => const GenSnapshot(),
- HotRunnerConfig: () => new HotRunnerConfig(),
+ HotRunnerConfig: () => HotRunnerConfig(),
IMobileDevice: () => const IMobileDevice(),
- IOSSimulatorUtils: () => new IOSSimulatorUtils(),
+ IOSSimulatorUtils: () => IOSSimulatorUtils(),
IOSWorkflow: () => const IOSWorkflow(),
IOSValidator: () => const IOSValidator(),
KernelCompiler: () => const KernelCompiler(),
- Logger: () => platform.isWindows ? new WindowsStdoutLogger() : new StdoutLogger(),
- OperatingSystemUtils: () => new OperatingSystemUtils(),
- SimControl: () => new SimControl(),
+ Logger: () => platform.isWindows ? WindowsStdoutLogger() : StdoutLogger(),
+ OperatingSystemUtils: () => OperatingSystemUtils(),
+ SimControl: () => SimControl(),
Stdio: () => const Stdio(),
- Usage: () => new Usage(),
- Xcode: () => new Xcode(),
- XcodeProjectInterpreter: () => new XcodeProjectInterpreter(),
+ Usage: () => Usage(),
+ Xcode: () => Xcode(),
+ XcodeProjectInterpreter: () => XcodeProjectInterpreter(),
},
);
}
diff --git a/packages/flutter_tools/lib/src/crash_reporting.dart b/packages/flutter_tools/lib/src/crash_reporting.dart
index 1bf1cd1..9018cee 100644
--- a/packages/flutter_tools/lib/src/crash_reporting.dart
+++ b/packages/flutter_tools/lib/src/crash_reporting.dart
@@ -52,12 +52,12 @@
CrashReportSender._(this._client);
- static CrashReportSender get instance => _instance ?? new CrashReportSender._(new http.Client());
+ static CrashReportSender get instance => _instance ?? CrashReportSender._(http.Client());
/// Overrides the default [http.Client] with [client] for testing purposes.
@visibleForTesting
static void initializeWith(http.Client client) {
- _instance = new CrashReportSender._(client);
+ _instance = CrashReportSender._(client);
}
final http.Client _client;
@@ -69,7 +69,7 @@
if (overrideUrl != null) {
return Uri.parse(overrideUrl);
}
- return new Uri(
+ return Uri(
scheme: 'https',
host: _kCrashServerHost,
port: 443,
@@ -99,7 +99,7 @@
},
);
- final http.MultipartRequest req = new http.MultipartRequest('POST', uri);
+ final http.MultipartRequest req = http.MultipartRequest('POST', uri);
req.fields['uuid'] = _usage.clientId;
req.fields['product'] = _kProductId;
req.fields['version'] = flutterVersion;
@@ -108,8 +108,8 @@
req.fields['type'] = _kDartTypeId;
req.fields['error_runtime_type'] = '${error.runtimeType}';
- final String stackTraceWithRelativePaths = new Chain.parse(stackTrace.toString()).terse.toString();
- req.files.add(new http.MultipartFile.fromString(
+ final String stackTraceWithRelativePaths = Chain.parse(stackTrace.toString()).terse.toString();
+ req.files.add(http.MultipartFile.fromString(
_kStackTraceFileField,
stackTraceWithRelativePaths,
filename: _kStackTraceFilename,
@@ -118,7 +118,7 @@
final http.StreamedResponse resp = await _client.send(req);
if (resp.statusCode == 200) {
- final String reportId = await new http.ByteStream(resp.stream)
+ final String reportId = await http.ByteStream(resp.stream)
.bytesToString();
printStatus('Crash report sent (report ID: $reportId)');
} else {
diff --git a/packages/flutter_tools/lib/src/dart/analysis.dart b/packages/flutter_tools/lib/src/dart/analysis.dart
index 5fce936..0815190 100644
--- a/packages/flutter_tools/lib/src/dart/analysis.dart
+++ b/packages/flutter_tools/lib/src/dart/analysis.dart
@@ -21,9 +21,9 @@
Process _process;
final StreamController<bool> _analyzingController =
- new StreamController<bool>.broadcast();
+ StreamController<bool>.broadcast();
final StreamController<FileAnalysisErrors> _errorsController =
- new StreamController<FileAnalysisErrors>.broadcast();
+ StreamController<FileAnalysisErrors>.broadcast();
int _id = 0;
@@ -132,10 +132,10 @@
final List<dynamic> errorsList = issueInfo['errors'];
final List<AnalysisError> errors = errorsList
.map<Map<String, dynamic>>(castStringKeyedMap)
- .map<AnalysisError>((Map<String, dynamic> json) => new AnalysisError(json))
+ .map<AnalysisError>((Map<String, dynamic> json) => AnalysisError(json))
.toList();
if (!_errorsController.isClosed)
- _errorsController.add(new FileAnalysisErrors(file, errors));
+ _errorsController.add(FileAnalysisErrors(file, errors));
}
Future<bool> dispose() async {
diff --git a/packages/flutter_tools/lib/src/dart/dependencies.dart b/packages/flutter_tools/lib/src/dart/dependencies.dart
index 28c7471..0b7fa12 100644
--- a/packages/flutter_tools/lib/src/dart/dependencies.dart
+++ b/packages/flutter_tools/lib/src/dart/dependencies.dart
@@ -39,7 +39,7 @@
Set<String> build() {
final List<String> dependencies = <String>[_mainScriptPath, _packagesFilePath];
final List<Uri> toProcess = <Uri>[_mainScriptUri];
- final PackageMap packageMap = new PackageMap(_packagesFilePath);
+ final PackageMap packageMap = PackageMap(_packagesFilePath);
while (toProcess.isNotEmpty) {
final Uri currentUri = toProcess.removeLast();
@@ -69,7 +69,7 @@
try {
uri = Uri.parse(uriAsString);
} on FormatException {
- throw new DartDependencyException('Unable to parse URI: $uriAsString');
+ throw DartDependencyException('Unable to parse URI: $uriAsString');
}
Uri resolvedUri = analyzer.resolveRelativeUri(currentUri, uri);
if (resolvedUri.scheme.startsWith('dart'))
@@ -77,7 +77,7 @@
if (resolvedUri.scheme == 'package') {
final Uri newResolvedUri = packageMap.uriForPackage(resolvedUri);
if (newResolvedUri == null) {
- throw new DartDependencyException(
+ throw DartDependencyException(
'The following Dart file:\n'
' ${currentUri.toFilePath()}\n'
'...refers, in an import, to the following library:\n'
@@ -91,7 +91,7 @@
final String path = canonicalizePath(resolvedUri.toFilePath());
if (!dependencies.contains(path)) {
if (!fs.isFileSync(path)) {
- throw new DartDependencyException(
+ throw DartDependencyException(
'The following Dart file:\n'
' ${currentUri.toFilePath()}\n'
'...refers, in an import, to the following library:\n'
@@ -112,7 +112,7 @@
try {
body = fs.file(path).readAsStringSync();
} on FileSystemException catch (error) {
- throw new DartDependencyException(
+ throw DartDependencyException(
'Could not read "$path" when determining Dart dependencies.',
error,
);
@@ -120,7 +120,7 @@
try {
return analyzer.parseDirectives(body, name: path);
} on analyzer.AnalyzerError catch (error) {
- throw new DartDependencyException(
+ throw DartDependencyException(
'When trying to parse this Dart file to find its dependencies:\n'
' $path\n'
'...the analyzer failed with the following error:\n'
@@ -128,7 +128,7 @@
error,
);
} on analyzer.AnalyzerErrorGroup catch (error) {
- throw new DartDependencyException(
+ throw DartDependencyException(
'When trying to parse this Dart file to find its dependencies:\n'
' $path\n'
'...the analyzer failed with the following error:\n'
diff --git a/packages/flutter_tools/lib/src/dart/package_map.dart b/packages/flutter_tools/lib/src/dart/package_map.dart
index c1b7bfc..6d94012 100644
--- a/packages/flutter_tools/lib/src/dart/package_map.dart
+++ b/packages/flutter_tools/lib/src/dart/package_map.dart
@@ -12,7 +12,7 @@
Map<String, Uri> _parse(String packagesPath) {
final List<int> source = fs.file(packagesPath).readAsBytesSync();
return packages_file.parse(source,
- new Uri.file(packagesPath, windows: platform.isWindows));
+ Uri.file(packagesPath, windows: platform.isWindows));
}
class PackageMap {
diff --git a/packages/flutter_tools/lib/src/dart/pub.dart b/packages/flutter_tools/lib/src/dart/pub.dart
index cd2d12c..816c775 100644
--- a/packages/flutter_tools/lib/src/dart/pub.dart
+++ b/packages/flutter_tools/lib/src/dart/pub.dart
@@ -23,32 +23,32 @@
// DO NOT update without contacting kevmoo.
// We have server-side tooling that assumes the values are consistent.
class PubContext {
- static final RegExp _validContext = new RegExp('[a-z][a-z_]*[a-z]');
+ static final RegExp _validContext = RegExp('[a-z][a-z_]*[a-z]');
- static final PubContext create = new PubContext._(<String>['create']);
- static final PubContext createPackage = new PubContext._(<String>['create_pkg']);
- static final PubContext createPlugin = new PubContext._(<String>['create_plugin']);
- static final PubContext interactive = new PubContext._(<String>['interactive']);
- static final PubContext pubGet = new PubContext._(<String>['get']);
- static final PubContext pubUpgrade = new PubContext._(<String>['upgrade']);
- static final PubContext runTest = new PubContext._(<String>['run_test']);
+ static final PubContext create = PubContext._(<String>['create']);
+ static final PubContext createPackage = PubContext._(<String>['create_pkg']);
+ static final PubContext createPlugin = PubContext._(<String>['create_plugin']);
+ static final PubContext interactive = PubContext._(<String>['interactive']);
+ static final PubContext pubGet = PubContext._(<String>['get']);
+ static final PubContext pubUpgrade = PubContext._(<String>['upgrade']);
+ static final PubContext runTest = PubContext._(<String>['run_test']);
- static final PubContext flutterTests = new PubContext._(<String>['flutter_tests']);
- static final PubContext updatePackages = new PubContext._(<String>['update_packages']);
+ static final PubContext flutterTests = PubContext._(<String>['flutter_tests']);
+ static final PubContext updatePackages = PubContext._(<String>['update_packages']);
final List<String> _values;
PubContext._(this._values) {
for (String item in _values) {
if (!_validContext.hasMatch(item)) {
- throw new ArgumentError.value(
+ throw ArgumentError.value(
_values, 'value', 'Must match RegExp ${_validContext.pattern}');
}
}
}
static PubContext getVerifyContext(String commandName) =>
- new PubContext._(<String>['verify', commandName.replaceAll('-', '_')]);
+ PubContext._(<String>['verify', commandName.replaceAll('-', '_')]);
@override
String toString() => 'PubContext: ${_values.join(':')}';
@@ -161,7 +161,7 @@
if (code != 69) // UNAVAILABLE in https://github.com/dart-lang/pub/blob/master/lib/src/exit_codes.dart
break;
printStatus('$failureMessage ($code) -- 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;
}
@@ -207,7 +207,7 @@
return environment;
}
-final RegExp _analyzerWarning = new RegExp(r'^! \w+ [^ ]+ from path \.\./\.\./bin/cache/dart-sdk/lib/\w+$');
+final RegExp _analyzerWarning = RegExp(r'^! \w+ [^ ]+ from path \.\./\.\./bin/cache/dart-sdk/lib/\w+$');
/// The console environment key used by the pub tool.
const String _pubEnvironmentKey = 'PUB_ENVIRONMENT';
diff --git a/packages/flutter_tools/lib/src/dependency_checker.dart b/packages/flutter_tools/lib/src/dependency_checker.dart
index 1ff6eaa..8316443 100644
--- a/packages/flutter_tools/lib/src/dependency_checker.dart
+++ b/packages/flutter_tools/lib/src/dependency_checker.dart
@@ -9,7 +9,7 @@
class DependencyChecker {
final DartDependencySetBuilder builder;
- final Set<String> _dependencies = new Set<String>();
+ final Set<String> _dependencies = Set<String>();
final AssetBundle assets;
DependencyChecker(this.builder, this.assets);
diff --git a/packages/flutter_tools/lib/src/devfs.dart b/packages/flutter_tools/lib/src/devfs.dart
index cb7f107..fd47054 100644
--- a/packages/flutter_tools/lib/src/devfs.dart
+++ b/packages/flutter_tools/lib/src/devfs.dart
@@ -59,7 +59,7 @@
DevFSFileContent(this.file);
static DevFSFileContent clone(DevFSFileContent fsFileContent) {
- final DevFSFileContent newFsFileContent = new DevFSFileContent(fsFileContent.file);
+ final DevFSFileContent newFsFileContent = DevFSFileContent(fsFileContent.file);
newFsFileContent._linkTarget = fsFileContent._linkTarget;
newFsFileContent._fileStat = fsFileContent._fileStat;
return newFsFileContent;
@@ -137,14 +137,14 @@
List<int> _bytes;
bool _isModified = true;
- DateTime _modificationTime = new DateTime.now();
+ DateTime _modificationTime = DateTime.now();
List<int> get bytes => _bytes;
set bytes(List<int> value) {
_bytes = value;
_isModified = true;
- _modificationTime = new DateTime.now();
+ _modificationTime = DateTime.now();
}
/// Return true only once so that the content is written to the device only once.
@@ -168,7 +168,7 @@
@override
Stream<List<int>> contentsAsStream() =>
- new Stream<List<int>>.fromIterable(<List<int>>[_bytes]);
+ Stream<List<int>>.fromIterable(<List<int>>[_bytes]);
}
/// String content to be copied to the device.
@@ -268,10 +268,10 @@
HttpClient _client;
Future<Null> write(Map<Uri, DevFSContent> entries) async {
- _client = new HttpClient();
+ _client = HttpClient();
_client.maxConnectionsPerHost = kMaxInFlight;
- _completer = new Completer<Null>();
- _outstanding = new Map<Uri, DevFSContent>.from(entries);
+ _completer = Completer<Null>();
+ _outstanding = Map<Uri, DevFSContent>.from(entries);
_scheduleWrites();
await _completer.future;
_client.close();
@@ -336,8 +336,8 @@
this.rootDirectory, {
String packagesFilePath
})
- : _operations = new ServiceProtocolDevFSOperations(serviceProtocol),
- _httpWriter = new _DevFSHttpWriter(fsName, serviceProtocol) {
+ : _operations = ServiceProtocolDevFSOperations(serviceProtocol),
+ _httpWriter = _DevFSHttpWriter(fsName, serviceProtocol) {
_packagesFilePath =
packagesFilePath ?? fs.path.join(rootDirectory.path, kPackagesFileName);
}
@@ -358,7 +358,7 @@
final Directory rootDirectory;
String _packagesFilePath;
final Map<Uri, DevFSContent> _entries = <Uri, DevFSContent>{};
- final Set<String> assetPathsToEvict = new Set<String>();
+ final Set<String> assetPathsToEvict = Set<String>();
final List<Future<Map<String, dynamic>>> _pendingOperations =
<Future<Map<String, dynamic>>>[];
@@ -485,7 +485,7 @@
// run with no changes is supposed to be fast (considering that it is
// initiated by user key press).
final List<String> invalidatedFiles = <String>[];
- final Set<Uri> filesUris = new Set<Uri>();
+ final Set<Uri> filesUris = Set<Uri>();
for (Uri uri in dirtyEntries.keys.toList()) {
if (!uri.path.startsWith(assetBuildDirPrefix)) {
final DevFSContent content = dirtyEntries[uri];
@@ -516,7 +516,7 @@
: pathToReload,
);
if (!dirtyEntries.containsKey(entryUri)) {
- final DevFSFileContent content = new DevFSFileContent(fs.file(compiledBinary));
+ final DevFSFileContent content = DevFSFileContent(fs.file(compiledBinary));
dirtyEntries[entryUri] = content;
numBytes += content.size;
}
@@ -528,10 +528,10 @@
await _httpWriter.write(dirtyEntries);
} on SocketException catch (socketException, stackTrace) {
printTrace('DevFS sync failed. Lost connection to device: $socketException');
- throw new DevFSException('Lost connection to device.', socketException, stackTrace);
+ throw DevFSException('Lost connection to device.', socketException, stackTrace);
} catch (exception, stackTrace) {
printError('Could not update files on device: $exception');
- throw new DevFSException('Sync failed', exception, stackTrace);
+ throw DevFSException('Sync failed', exception, stackTrace);
}
} else {
// Make service protocol requests for each.
@@ -552,7 +552,7 @@
}
void _scanFile(Uri deviceUri, FileSystemEntity file) {
- final DevFSContent content = _entries.putIfAbsent(deviceUri, () => new DevFSFileContent(file));
+ final DevFSContent content = _entries.putIfAbsent(deviceUri, () => DevFSFileContent(file));
content._exists = true;
}
@@ -601,7 +601,7 @@
if (directoryUriOnDevice == null) {
final String relativeRootPath = fs.path.relative(directory.path, from: rootDirectory.path);
if (relativeRootPath == '.') {
- directoryUriOnDevice = new Uri();
+ directoryUriOnDevice = Uri();
} else {
directoryUriOnDevice = fs.path.toUri(relativeRootPath);
}
@@ -699,7 +699,7 @@
Future<Null> _scanPackages(Set<String> fileFilter) async {
StringBuffer sb;
- final PackageMap packageMap = new PackageMap(_packagesFilePath);
+ final PackageMap packageMap = PackageMap(_packagesFilePath);
for (String packageName in packageMap.map.keys) {
final Uri packageUri = packageMap.map[packageName];
@@ -726,7 +726,7 @@
fileFilter: fileFilter);
}
if (packageExists) {
- sb ??= new StringBuffer();
+ sb ??= StringBuffer();
sb.writeln('$packageName:$directoryUriOnDevice');
}
}
diff --git a/packages/flutter_tools/lib/src/device.dart b/packages/flutter_tools/lib/src/device.dart
index 78121b0..61ff0ab 100644
--- a/packages/flutter_tools/lib/src/device.dart
+++ b/packages/flutter_tools/lib/src/device.dart
@@ -24,10 +24,10 @@
/// of their methods are called.
DeviceManager() {
// Register the known discoverers.
- _deviceDiscoverers.add(new AndroidDevices());
- _deviceDiscoverers.add(new IOSDevices());
- _deviceDiscoverers.add(new IOSSimulators());
- _deviceDiscoverers.add(new FlutterTesterDevices());
+ _deviceDiscoverers.add(AndroidDevices());
+ _deviceDiscoverers.add(IOSDevices());
+ _deviceDiscoverers.add(IOSSimulators());
+ _deviceDiscoverers.add(FlutterTesterDevices());
}
final List<DeviceDiscovery> _deviceDiscoverers = <DeviceDiscovery>[];
@@ -121,7 +121,7 @@
/// Gets a list of diagnostic messages pertaining to issues with any connected
/// devices (will be an empty list if there are no issues).
- Future<List<String>> getDiagnostics() => new Future<List<String>>.value(<String>[]);
+ Future<List<String>> getDiagnostics() => Future<List<String>>.value(<String>[]);
}
/// A [DeviceDiscovery] implementation that uses polling to discover device adds
@@ -140,9 +140,9 @@
void startPolling() {
if (_poller == null) {
- _items ??= new ItemListNotifier<Device>();
+ _items ??= ItemListNotifier<Device>();
- _poller = new Poller(() async {
+ _poller = Poller(() async {
try {
final List<Device> devices = await pollingGetDevices().timeout(_pollingTimeout);
_items.updateWithNewList(devices);
@@ -160,17 +160,17 @@
@override
Future<List<Device>> get devices async {
- _items ??= new ItemListNotifier<Device>.from(await pollingGetDevices());
+ _items ??= ItemListNotifier<Device>.from(await pollingGetDevices());
return _items.items;
}
Stream<Device> get onAdded {
- _items ??= new ItemListNotifier<Device>();
+ _items ??= ItemListNotifier<Device>();
return _items.onAdded;
}
Stream<Device> get onRemoved {
- _items ??= new ItemListNotifier<Device>();
+ _items ??= ItemListNotifier<Device>();
return _items.onRemoved;
}
@@ -275,7 +275,7 @@
bool get supportsScreenshot => false;
- Future<void> takeScreenshot(File outputFile) => new Future<Null>.error('unimplemented');
+ Future<void> takeScreenshot(File outputFile) => Future<Null>.error('unimplemented');
@override
int get hashCode => id.hashCode;
@@ -314,7 +314,7 @@
}
// Calculate column widths
- final List<int> indices = new List<int>.generate(table[0].length - 1, (int i) => i);
+ final List<int> indices = List<int>.generate(table[0].length - 1, (int i) => i);
List<int> widths = indices.map((int i) => 0).toList();
for (List<String> row in table) {
widths = indices.map((int i) => math.max(widths[i], row[i].length)).toList();
@@ -374,7 +374,7 @@
@override
String toString() {
- final StringBuffer buf = new StringBuffer('started=$started');
+ final StringBuffer buf = StringBuffer('started=$started');
if (observatoryUri != null)
buf.write(', observatory=$observatoryUri');
return buf.toString();
diff --git a/packages/flutter_tools/lib/src/disabled_usage.dart b/packages/flutter_tools/lib/src/disabled_usage.dart
index 5705361..a499070 100644
--- a/packages/flutter_tools/lib/src/disabled_usage.dart
+++ b/packages/flutter_tools/lib/src/disabled_usage.dart
@@ -41,7 +41,7 @@
Stream<Map<String, dynamic>> get onSend => null;
@override
- Future<Null> ensureAnalyticsSent() => new Future<Null>.value();
+ Future<Null> ensureAnalyticsSent() => Future<Null>.value();
@override
void printWelcome() { }
diff --git a/packages/flutter_tools/lib/src/doctor.dart b/packages/flutter_tools/lib/src/doctor.dart
index 8d23024..6cf154c 100644
--- a/packages/flutter_tools/lib/src/doctor.dart
+++ b/packages/flutter_tools/lib/src/doctor.dart
@@ -31,7 +31,7 @@
/// The singleton instance, pulled from the [AppContext].
static DoctorValidatorsProvider get instance => context[DoctorValidatorsProvider];
- static final DoctorValidatorsProvider defaultInstance = new _DefaultDoctorValidatorsProvider();
+ static final DoctorValidatorsProvider defaultInstance = _DefaultDoctorValidatorsProvider();
List<DoctorValidator> get validators;
List<Workflow> get workflows;
@@ -45,7 +45,7 @@
List<DoctorValidator> get validators {
if (_validators == null) {
_validators = <DoctorValidator>[];
- _validators.add(new _FlutterValidator());
+ _validators.add(_FlutterValidator());
if (androidWorkflow.appliesToHostPlatform)
_validators.add(androidValidator);
@@ -60,10 +60,10 @@
if (ideValidators.isNotEmpty)
_validators.addAll(ideValidators);
else
- _validators.add(new NoIdeValidator());
+ _validators.add(NoIdeValidator());
if (deviceManager.canListAnything)
- _validators.add(new DeviceValidator());
+ _validators.add(DeviceValidator());
}
return _validators;
}
@@ -102,7 +102,7 @@
List<ValidatorTask> startValidatorTasks() {
final List<ValidatorTask> tasks = <ValidatorTask>[];
for (DoctorValidator validator in validators) {
- tasks.add(new ValidatorTask(validator, validator.validate()));
+ tasks.add(ValidatorTask(validator, validator.validate()));
}
return tasks;
}
@@ -117,11 +117,11 @@
}
Future<String> get summaryText async {
- final StringBuffer buffer = new StringBuffer();
+ final StringBuffer buffer = StringBuffer();
bool allGood = true;
- final Set<ValidatorCategory> finishedGroups = new Set<ValidatorCategory>();
+ final Set<ValidatorCategory> finishedGroups = Set<ValidatorCategory>();
for (DoctorValidator validator in validators) {
final ValidatorCategory currentCategory = validator.category;
ValidationResult result;
@@ -182,11 +182,11 @@
final List<ValidatorTask> taskList = startValidatorTasks();
- final Set<ValidatorCategory> finishedGroups = new Set<ValidatorCategory>();
+ final Set<ValidatorCategory> finishedGroups = Set<ValidatorCategory>();
for (ValidatorTask validatorTask in taskList) {
final DoctorValidator validator = validatorTask.validator;
final ValidatorCategory currentCategory = validator.category;
- final Status status = new Status.withSpinner();
+ final Status status = Status.withSpinner();
ValidationResult result;
if (currentCategory.isGrouped) {
@@ -281,7 +281,7 @@
mergedMessages.addAll(result.messages);
}
- return new ValidationResult(mergedType, mergedMessages,
+ return ValidationResult(mergedType, mergedMessages,
statusInfo: results[0].statusInfo);
}
@@ -392,19 +392,19 @@
final FlutterVersion version = FlutterVersion.instance;
- messages.add(new ValidationMessage('Flutter version ${version.frameworkVersion} at ${Cache.flutterRoot}'));
- messages.add(new ValidationMessage(
+ messages.add(ValidationMessage('Flutter version ${version.frameworkVersion} at ${Cache.flutterRoot}'));
+ messages.add(ValidationMessage(
'Framework revision ${version.frameworkRevisionShort} '
'(${version.frameworkAge}), ${version.frameworkDate}'
));
- messages.add(new ValidationMessage('Engine revision ${version.engineRevisionShort}'));
- messages.add(new ValidationMessage('Dart version ${version.dartSdkVersion}'));
+ messages.add(ValidationMessage('Engine revision ${version.engineRevisionShort}'));
+ messages.add(ValidationMessage('Dart version ${version.dartSdkVersion}'));
final String genSnapshotPath =
artifacts.getArtifactPath(Artifact.genSnapshot);
// Check that the binaries we downloaded for this platform actually run on it.
if (!_genSnapshotRuns(genSnapshotPath)) {
- final StringBuffer buf = new StringBuffer();
+ final StringBuffer buf = StringBuffer();
buf.writeln('Downloaded executables cannot execute on host.');
buf.writeln('See https://github.com/flutter/flutter/issues/6207 for more information');
if (platform.isLinux) {
@@ -412,11 +412,11 @@
buf.writeln('On Fedora: dnf install libstdc++.i686');
buf.writeln('On Arch: pacman -S lib32-libstdc++5');
}
- messages.add(new ValidationMessage.error(buf.toString()));
+ messages.add(ValidationMessage.error(buf.toString()));
valid = ValidationType.partial;
}
- return new ValidationResult(valid, messages,
+ return ValidationResult(valid, messages,
statusInfo: 'Channel ${version.channel}, v${version.frameworkVersion}, on ${os.name}, locale ${platform.localeName}'
);
}
@@ -436,8 +436,8 @@
@override
Future<ValidationResult> validate() async {
- return new ValidationResult(ValidationType.missing, <ValidationMessage>[
- new ValidationMessage('IntelliJ - https://www.jetbrains.com/idea/'),
+ return ValidationResult(ValidationType.missing, <ValidationMessage>[
+ ValidationMessage('IntelliJ - https://www.jetbrains.com/idea/'),
], statusInfo: 'No supported IDEs installed');
}
}
@@ -455,7 +455,7 @@
'IdeaIC' : 'IntelliJ IDEA Community Edition',
};
- static final Version kMinIdeaVersion = new Version(2017, 1, 0);
+ static final Version kMinIdeaVersion = Version(2017, 1, 0);
static Iterable<DoctorValidator> get installedValidators {
if (platform.isLinux || platform.isWindows)
@@ -469,15 +469,15 @@
Future<ValidationResult> validate() async {
final List<ValidationMessage> messages = <ValidationMessage>[];
- messages.add(new ValidationMessage('IntelliJ at $installPath'));
+ messages.add(ValidationMessage('IntelliJ at $installPath'));
- final IntelliJPlugins plugins = new IntelliJPlugins(pluginsPath);
+ final IntelliJPlugins plugins = IntelliJPlugins(pluginsPath);
plugins.validatePackage(messages, <String>['flutter-intellij', 'flutter-intellij.jar'],
'Flutter', minVersion: IntelliJPlugins.kMinFlutterPluginVersion);
plugins.validatePackage(messages, <String>['Dart'], 'Dart');
if (_hasIssues(messages)) {
- messages.add(new ValidationMessage(
+ messages.add(ValidationMessage(
'For information about installing plugins, see\n'
'https://flutter.io/intellij-setup/#installing-the-plugins'
));
@@ -485,7 +485,7 @@
_validateIntelliJVersion(messages, kMinIdeaVersion);
- return new ValidationResult(
+ return ValidationResult(
_hasIssues(messages) ? ValidationType.partial : ValidationType.installed,
messages,
statusInfo: 'version $version'
@@ -501,12 +501,12 @@
if (minVersion == Version.unknown)
return;
- final Version installedVersion = new Version.parse(version);
+ final Version installedVersion = Version.parse(version);
if (installedVersion == null)
return;
if (installedVersion < minVersion) {
- messages.add(new ValidationMessage.error(
+ messages.add(ValidationMessage.error(
'This install is older than the minimum recommended version of $minVersion.'
));
}
@@ -529,7 +529,7 @@
void addValidator(String title, String version, String installPath, String pluginsPath) {
final IntelliJValidatorOnLinuxAndWindows validator =
- new IntelliJValidatorOnLinuxAndWindows(title, version, installPath, pluginsPath);
+ IntelliJValidatorOnLinuxAndWindows(title, version, installPath, pluginsPath);
for (int index = 0; index < validators.length; ++index) {
final DoctorValidator other = validators[index];
if (other is IntelliJValidatorOnLinuxAndWindows && validator.installPath == other.installPath) {
@@ -585,7 +585,7 @@
_dirNameToId.forEach((String dirName, String id) {
if (name == dirName) {
final String title = IntelliJValidator._idToTitle[id];
- validators.add(new IntelliJValidatorOnMac(title, id, dir.path));
+ validators.add(IntelliJValidatorOnMac(title, id, dir.path));
}
});
}
@@ -607,10 +607,10 @@
}
}
} on FileSystemException catch (e) {
- validators.add(new ValidatorWithResult(
+ validators.add(ValidatorWithResult(
'Cannot determine if IntelliJ is installed',
- new ValidationResult(ValidationType.missing, <ValidationMessage>[
- new ValidationMessage.error(e.message),
+ ValidationResult(ValidationType.missing, <ValidationMessage>[
+ ValidationMessage.error(e.message),
]),
));
}
@@ -649,19 +649,19 @@
if (devices.isEmpty) {
final List<String> diagnostics = await deviceManager.getDeviceDiagnostics();
if (diagnostics.isNotEmpty) {
- messages = diagnostics.map((String message) => new ValidationMessage(message)).toList();
+ messages = diagnostics.map((String message) => ValidationMessage(message)).toList();
} else {
- messages = <ValidationMessage>[new ValidationMessage.hint('No devices available')];
+ messages = <ValidationMessage>[ValidationMessage.hint('No devices available')];
}
} else {
messages = await Device.descriptions(devices)
- .map((String msg) => new ValidationMessage(msg)).toList();
+ .map((String msg) => ValidationMessage(msg)).toList();
}
if (devices.isEmpty) {
- return new ValidationResult(ValidationType.partial, messages);
+ return ValidationResult(ValidationType.partial, messages);
} else {
- return new ValidationResult(ValidationType.installed, messages, statusInfo: '${devices.length} available');
+ return ValidationResult(ValidationType.installed, messages, statusInfo: '${devices.length} available');
}
}
}
diff --git a/packages/flutter_tools/lib/src/emulator.dart b/packages/flutter_tools/lib/src/emulator.dart
index e0e144a..c40497c 100644
--- a/packages/flutter_tools/lib/src/emulator.dart
+++ b/packages/flutter_tools/lib/src/emulator.dart
@@ -21,8 +21,8 @@
/// of their methods are called.
EmulatorManager() {
// Register the known discoverers.
- _emulatorDiscoverers.add(new AndroidEmulators());
- _emulatorDiscoverers.add(new IOSEmulators());
+ _emulatorDiscoverers.add(AndroidEmulators());
+ _emulatorDiscoverers.add(IOSEmulators());
}
final List<EmulatorDiscovery> _emulatorDiscoverers = <EmulatorDiscovery>[];
@@ -81,12 +81,12 @@
final String device = await _getPreferredAvailableDevice();
if (device == null)
- return new CreateEmulatorResult(name,
+ return CreateEmulatorResult(name,
success: false, error: 'No device definitions are available');
final String sdkId = await _getPreferredSdkId();
if (sdkId == null)
- return new CreateEmulatorResult(name,
+ return CreateEmulatorResult(name,
success: false,
error:
'No suitable Android AVD system images are available. You may need to install these'
@@ -119,7 +119,7 @@
];
final ProcessResult runResult = processManager.runSync(args,
environment: androidSdk?.sdkManagerEnv);
- return new CreateEmulatorResult(
+ return CreateEmulatorResult(
name,
success: runResult.exitCode == 0,
output: runResult.stdout,
@@ -154,7 +154,7 @@
);
}
- RegExp androidApiVersion = new RegExp(r';android-(\d+);');
+ RegExp androidApiVersion = RegExp(r';android-(\d+);');
Future<String> _getPreferredSdkId() async {
// It seems that to get the available list of images, we need to send a
// request to create without the image and it'll provide us a list :-(
@@ -252,14 +252,14 @@
}
// Calculate column widths
- final List<int> indices = new List<int>.generate(table[0].length - 1, (int i) => i);
+ final List<int> indices = List<int>.generate(table[0].length - 1, (int i) => i);
List<int> widths = indices.map((int i) => 0).toList();
for (List<String> row in table) {
widths = indices.map((int i) => math.max(widths[i], row[i].length)).toList();
}
// Join columns into lines of text
- final RegExp whiteSpaceAndDots = new RegExp(r'[•\s]+$');
+ final RegExp whiteSpaceAndDots = RegExp(r'[•\s]+$');
return table
.map((List<String> row) {
return indices
diff --git a/packages/flutter_tools/lib/src/flutter_manifest.dart b/packages/flutter_tools/lib/src/flutter_manifest.dart
index 60b3fb3..9e937f4 100644
--- a/packages/flutter_tools/lib/src/flutter_manifest.dart
+++ b/packages/flutter_tools/lib/src/flutter_manifest.dart
@@ -14,7 +14,7 @@
import 'cache.dart';
import 'globals.dart';
-final RegExp _versionPattern = new RegExp(r'^(\d+)(\.(\d+)(\.(\d+))?)?(\+(\d+))?$');
+final RegExp _versionPattern = RegExp(r'^(\d+)(\.(\d+)(\.(\d+))?)?(\+(\d+))?$');
/// A wrapper around the `flutter` section in the `pubspec.yaml` file.
class FlutterManifest {
@@ -22,7 +22,7 @@
/// Returns an empty manifest.
static FlutterManifest empty() {
- final FlutterManifest manifest = new FlutterManifest._();
+ final FlutterManifest manifest = FlutterManifest._();
manifest._descriptor = const <String, dynamic>{};
manifest._flutterDescriptor = const <String, dynamic>{};
return manifest;
@@ -43,7 +43,7 @@
}
static Future<FlutterManifest> _createFromYaml(dynamic yamlDocument) async {
- final FlutterManifest pubspec = new FlutterManifest._();
+ final FlutterManifest pubspec = FlutterManifest._();
if (yamlDocument != null && !await _validate(yamlDocument))
return null;
@@ -199,14 +199,14 @@
continue;
}
- fontAssets.add(new FontAsset(
+ fontAssets.add(FontAsset(
Uri.parse(asset),
weight: fontFile['weight'],
style: fontFile['style'],
));
}
if (fontAssets.isNotEmpty)
- fonts.add(new Font(fontFamily['family'], fontAssets));
+ fonts.add(Font(fontFamily['family'], fontAssets));
}
return fonts;
}
@@ -277,7 +277,7 @@
final String schemaData = fs.file(schemaPath).readAsStringSync();
final Schema schema = await Schema.createSchema(
convert.json.decode(schemaData));
- final Validator validator = new Validator(schema);
+ final Validator validator = Validator(schema);
if (validator.validate(manifest)) {
return true;
} else {
diff --git a/packages/flutter_tools/lib/src/fuchsia/fuchsia_device.dart b/packages/flutter_tools/lib/src/fuchsia/fuchsia_device.dart
index f6cb30f..0c02bcc 100644
--- a/packages/flutter_tools/lib/src/fuchsia/fuchsia_device.dart
+++ b/packages/flutter_tools/lib/src/fuchsia/fuchsia_device.dart
@@ -49,7 +49,7 @@
Future<bool> isLatestBuildInstalled(ApplicationPackage app) async => false;
@override
- Future<bool> installApp(ApplicationPackage app) => new Future<bool>.value(false);
+ Future<bool> installApp(ApplicationPackage app) => Future<bool>.value(false);
@override
Future<bool> uninstallApp(ApplicationPackage app) async => false;
@@ -68,7 +68,7 @@
bool applicationNeedsRebuild = false,
bool usesTerminalUi = false,
bool ipv6 = false,
- }) => new Future<Null>.error('unimplemented');
+ }) => Future<Null>.error('unimplemented');
@override
Future<bool> stopApp(ApplicationPackage app) async {
@@ -85,7 +85,7 @@
_FuchsiaLogReader _logReader;
@override
DeviceLogReader getLogReader({ApplicationPackage app}) {
- _logReader ??= new _FuchsiaLogReader(this);
+ _logReader ??= _FuchsiaLogReader(this);
return _logReader;
}
diff --git a/packages/flutter_tools/lib/src/intellij/intellij.dart b/packages/flutter_tools/lib/src/intellij/intellij.dart
index ced7d72..03f2d0f 100644
--- a/packages/flutter_tools/lib/src/intellij/intellij.dart
+++ b/packages/flutter_tools/lib/src/intellij/intellij.dart
@@ -11,7 +11,7 @@
import '../doctor.dart';
class IntelliJPlugins {
- static final Version kMinFlutterPluginVersion = new Version(16, 0, 0);
+ static final Version kMinFlutterPluginVersion = Version(16, 0, 0);
final String pluginsPath;
@@ -26,19 +26,19 @@
}
final String versionText = _readPackageVersion(packageName);
- final Version version = new Version.parse(versionText);
+ final Version version = Version.parse(versionText);
if (version != null && minVersion != null && version < minVersion) {
- messages.add(new ValidationMessage.error(
+ messages.add(ValidationMessage.error(
'$title plugin version $versionText - the recommended minimum version is $minVersion'));
} else {
- messages.add(new ValidationMessage(
+ messages.add(ValidationMessage(
'$title plugin ${version != null ? "version $version" : "installed"}'));
}
return;
}
- messages.add(new ValidationMessage.error(
+ messages.add(ValidationMessage.error(
'$title plugin not installed; this adds $title specific functionality.'));
}
@@ -57,7 +57,7 @@
// rather than reading the entire file into memory.
try {
final Archive archive =
- new ZipDecoder().decodeBytes(fs.file(jarPath).readAsBytesSync());
+ ZipDecoder().decodeBytes(fs.file(jarPath).readAsBytesSync());
final ArchiveFile file = archive.findFile('META-INF/plugin.xml');
final String content = utf8.decode(file.content);
const String versionStartTag = '<version>';
diff --git a/packages/flutter_tools/lib/src/ios/cocoapods.dart b/packages/flutter_tools/lib/src/ios/cocoapods.dart
index 1b98d2b..96f7d32 100644
--- a/packages/flutter_tools/lib/src/ios/cocoapods.dart
+++ b/packages/flutter_tools/lib/src/ios/cocoapods.dart
@@ -65,10 +65,10 @@
if (versionText == null)
return CocoaPodsStatus.notInstalled;
try {
- final Version installedVersion = new Version.parse(versionText);
- if (installedVersion < new Version.parse(cocoaPodsMinimumVersion))
+ final Version installedVersion = Version.parse(versionText);
+ if (installedVersion < Version.parse(cocoaPodsMinimumVersion))
return CocoaPodsStatus.belowMinimumVersion;
- else if (installedVersion < new Version.parse(cocoaPodsRecommendedVersion))
+ else if (installedVersion < Version.parse(cocoaPodsRecommendedVersion))
return CocoaPodsStatus.belowRecommendedVersion;
else
return CocoaPodsStatus.recommended;
diff --git a/packages/flutter_tools/lib/src/ios/code_signing.dart b/packages/flutter_tools/lib/src/ios/code_signing.dart
index a060eb1..0774bf1 100644
--- a/packages/flutter_tools/lib/src/ios/code_signing.dart
+++ b/packages/flutter_tools/lib/src/ios/code_signing.dart
@@ -79,9 +79,9 @@
final RegExp _securityFindIdentityDeveloperIdentityExtractionPattern =
- new RegExp(r'^\s*\d+\).+"(.+Developer.+)"$');
-final RegExp _securityFindIdentityCertificateCnExtractionPattern = new RegExp(r'.*\(([a-zA-Z0-9]+)\)');
-final RegExp _certificateOrganizationalUnitExtractionPattern = new RegExp(r'OU=([a-zA-Z0-9]+)');
+ RegExp(r'^\s*\d+\).+"(.+Developer.+)"$');
+final RegExp _securityFindIdentityCertificateCnExtractionPattern = RegExp(r'.*\(([a-zA-Z0-9]+)\)');
+final RegExp _certificateOrganizationalUnitExtractionPattern = RegExp(r'OU=([a-zA-Z0-9]+)');
/// Given a [BuildableIOSApp], this will try to find valid development code
/// signing identities in the user's keychain prompting a choice if multiple
@@ -217,7 +217,7 @@
printStatus(' a) Abort', emphasis: true);
final String choice = await terminal.promptForCharInput(
- new List<String>.generate(count, (int number) => '${number + 1}')
+ List<String>.generate(count, (int number) => '${number + 1}')
..add('a'),
prompt: 'Please select a certificate for code signing',
displayAcceptedCharacters: true,
diff --git a/packages/flutter_tools/lib/src/ios/devices.dart b/packages/flutter_tools/lib/src/ios/devices.dart
index d9e7750..111b654 100644
--- a/packages/flutter_tools/lib/src/ios/devices.dart
+++ b/packages/flutter_tools/lib/src/ios/devices.dart
@@ -60,7 +60,7 @@
// python at the front of the path, which may not include package 'six'.
// Ensure that we pick up the system install of python, which does include
// it.
- final Map<String, String> iosDeployEnv = new Map<String, String>.from(platform.environment);
+ final Map<String, String> iosDeployEnv = Map<String, String>.from(platform.environment);
iosDeployEnv['PATH'] = '/usr/bin:${iosDeployEnv['PATH']}';
return await runCommandAndStreamOutput(
@@ -151,7 +151,7 @@
final String deviceName = await iMobileDevice.getInfoForDevice(id, 'DeviceName');
final String sdkVersion = await iMobileDevice.getInfoForDevice(id, 'ProductVersion');
- devices.add(new IOSDevice(id, name: deviceName, sdkVersion: sdkVersion));
+ devices.add(IOSDevice(id, name: deviceName, sdkVersion: sdkVersion));
}
return devices;
}
@@ -177,7 +177,7 @@
Future<bool> isAppInstalled(ApplicationPackage app) async {
try {
final RunResult apps = await runCheckedAsync(<String>[_installerPath, '--list-apps']);
- if (new RegExp(app.id, multiLine: true).hasMatch(apps.stdout)) {
+ if (RegExp(app.id, multiLine: true).hasMatch(apps.stdout)) {
return true;
}
} catch (e) {
@@ -247,11 +247,11 @@
printError('Could not build the precompiled application for the device.');
await diagnoseXcodeBuildFailure(buildResult);
printError('');
- return new LaunchResult.failed();
+ return LaunchResult.failed();
}
} else {
if (!await installApp(package))
- return new LaunchResult.failed();
+ return LaunchResult.failed();
}
// Step 2: Check that the application exists at the specified path.
@@ -259,7 +259,7 @@
final Directory bundle = fs.directory(iosApp.deviceBundlePath);
if (!bundle.existsSync()) {
printError('Could not find the built application bundle at ${bundle.path}.');
- return new LaunchResult.failed();
+ return LaunchResult.failed();
}
// Step 3: Attempt to install the application on the device.
@@ -305,7 +305,7 @@
// TODO(danrubel): The Android device class does something similar to this code below.
// The various Device subclasses should be refactored and common code moved into the superclass.
- final ProtocolDiscovery observatoryDiscovery = new ProtocolDiscovery.observatory(
+ final ProtocolDiscovery observatoryDiscovery = ProtocolDiscovery.observatory(
getLogReader(app: package),
portForwarder: portForwarder,
hostPort: debuggingOptions.observatoryPort,
@@ -341,10 +341,10 @@
printError('Try launching Xcode and selecting "Product > Run" to fix the problem:');
printError(' open ios/Runner.xcworkspace');
printError('');
- return new LaunchResult.failed();
+ return LaunchResult.failed();
}
- return new LaunchResult.succeeded(observatoryUri: localObservatoryUri);
+ return LaunchResult.succeeded(observatoryUri: localObservatoryUri);
}
@override
@@ -362,11 +362,11 @@
@override
DeviceLogReader getLogReader({ApplicationPackage app}) {
_logReaders ??= <ApplicationPackage, _IOSDeviceLogReader>{};
- return _logReaders.putIfAbsent(app, () => new _IOSDeviceLogReader(this, app));
+ return _logReaders.putIfAbsent(app, () => _IOSDeviceLogReader(this, app));
}
@override
- DevicePortForwarder get portForwarder => _portForwarder ??= new _IOSDevicePortForwarder(this);
+ DevicePortForwarder get portForwarder => _portForwarder ??= _IOSDevicePortForwarder(this);
@override
void clearLogs() {
@@ -446,7 +446,7 @@
RegExp _anyLineRegex;
_IOSDeviceLogReader(this.device, ApplicationPackage app) {
- _linesController = new StreamController<String>.broadcast(
+ _linesController = StreamController<String>.broadcast(
onListen: _start,
onCancel: _stop
);
@@ -456,11 +456,11 @@
// iOS 9 format: Runner[297] <Notice>:
// iOS 10 format: Runner(Flutter)[297] <Notice>:
final String appName = app == null ? '' : app.name.replaceAll('.app', '');
- _runnerLineRegex = new RegExp(appName + r'(\(Flutter\))?\[[\d]+\] <[A-Za-z]+>: ');
+ _runnerLineRegex = RegExp(appName + r'(\(Flutter\))?\[[\d]+\] <[A-Za-z]+>: ');
// Similar to above, but allows ~arbitrary components instead of "Runner"
// and "Flutter". The regex tries to strike a balance between not producing
// false positives and not producing false negatives.
- _anyLineRegex = new RegExp(r'\w+(\([^)]*\))?\[\d+\] <[A-Za-z]+>: ');
+ _anyLineRegex = RegExp(r'\w+(\([^)]*\))?\[\d+\] <[A-Za-z]+>: ');
}
final IOSDevice device;
@@ -558,16 +558,16 @@
if (autoselect) {
hostPort += 1;
if (hostPort > 65535)
- throw new Exception('Could not find open port on host.');
+ throw Exception('Could not find open port on host.');
} else {
- throw new Exception('Port $hostPort is not available.');
+ throw Exception('Port $hostPort is not available.');
}
}
}
assert(connected);
assert(process != null);
- final ForwardedPort forwardedPort = new ForwardedPort.withContext(
+ final ForwardedPort forwardedPort = ForwardedPort.withContext(
hostPort, devicePort, process,
);
printTrace('Forwarded port $forwardedPort');
diff --git a/packages/flutter_tools/lib/src/ios/ios_emulators.dart b/packages/flutter_tools/lib/src/ios/ios_emulators.dart
index f9c3a57..a6d197d 100644
--- a/packages/flutter_tools/lib/src/ios/ios_emulators.dart
+++ b/packages/flutter_tools/lib/src/ios/ios_emulators.dart
@@ -67,5 +67,5 @@
return <IOSEmulator>[];
}
- return <IOSEmulator>[new IOSEmulator('apple_ios_simulator')];
+ return <IOSEmulator>[IOSEmulator('apple_ios_simulator')];
}
diff --git a/packages/flutter_tools/lib/src/ios/ios_workflow.dart b/packages/flutter_tools/lib/src/ios/ios_workflow.dart
index 718d37c..c752cef 100644
--- a/packages/flutter_tools/lib/src/ios/ios_workflow.dart
+++ b/packages/flutter_tools/lib/src/ios/ios_workflow.dart
@@ -61,8 +61,8 @@
if (!await hasIosDeploy)
return false;
try {
- final Version version = new Version.parse(await iosDeployVersionText);
- return version >= new Version.parse(iosDeployMinimumVersion);
+ final Version version = Version.parse(await iosDeployVersionText);
+ return version >= Version.parse(iosDeployMinimumVersion);
} on FormatException catch (_) {
return false;
}
@@ -78,16 +78,16 @@
if (xcode.isInstalled) {
xcodeStatus = ValidationType.installed;
- messages.add(new ValidationMessage('Xcode at ${xcode.xcodeSelectPath}'));
+ messages.add(ValidationMessage('Xcode at ${xcode.xcodeSelectPath}'));
xcodeVersionInfo = xcode.versionText;
if (xcodeVersionInfo.contains(','))
xcodeVersionInfo = xcodeVersionInfo.substring(0, xcodeVersionInfo.indexOf(','));
- messages.add(new ValidationMessage(xcode.versionText));
+ messages.add(ValidationMessage(xcode.versionText));
if (!xcode.isInstalledAndMeetsVersionCheck) {
xcodeStatus = ValidationType.partial;
- messages.add(new ValidationMessage.error(
+ messages.add(ValidationMessage.error(
'Flutter requires a minimum Xcode version of $kXcodeRequiredVersionMajor.$kXcodeRequiredVersionMinor.0.\n'
'Download the latest version or update via the Mac App Store.'
));
@@ -95,13 +95,13 @@
if (!xcode.eulaSigned) {
xcodeStatus = ValidationType.partial;
- messages.add(new ValidationMessage.error(
+ messages.add(ValidationMessage.error(
'Xcode end user license agreement not signed; open Xcode or run the command \'sudo xcodebuild -license\'.'
));
}
if (!xcode.isSimctlInstalled) {
xcodeStatus = ValidationType.partial;
- messages.add(new ValidationMessage.error(
+ messages.add(ValidationMessage.error(
'Xcode requires additional components to be installed in order to run.\n'
'Launch Xcode and install additional required components when prompted.'
));
@@ -110,12 +110,12 @@
} else {
xcodeStatus = ValidationType.missing;
if (xcode.xcodeSelectPath == null || xcode.xcodeSelectPath.isEmpty) {
- messages.add(new ValidationMessage.error(
+ messages.add(ValidationMessage.error(
'Xcode not installed; this is necessary for iOS development.\n'
'Download at https://developer.apple.com/xcode/download/.'
));
} else {
- messages.add(new ValidationMessage.error(
+ messages.add(ValidationMessage.error(
'Xcode installation is incomplete; a full installation is necessary for iOS development.\n'
'Download at: https://developer.apple.com/xcode/download/\n'
'Or install Xcode via the App Store.\n'
@@ -131,14 +131,14 @@
if (!iMobileDevice.isInstalled) {
brewStatus = ValidationType.partial;
- messages.add(new ValidationMessage.error(
+ messages.add(ValidationMessage.error(
'libimobiledevice and ideviceinstaller are not installed. To install, run:\n'
' brew install --HEAD libimobiledevice\n'
' brew install ideviceinstaller'
));
} else if (!await iMobileDevice.isWorking) {
brewStatus = ValidationType.partial;
- messages.add(new ValidationMessage.error(
+ messages.add(ValidationMessage.error(
'Verify that all connected devices have been paired with this computer in Xcode.\n'
'If all devices have been paired, libimobiledevice and ideviceinstaller may require updating.\n'
'To update, run:\n'
@@ -148,7 +148,7 @@
));
} else if (!await hasIDeviceInstaller) {
brewStatus = ValidationType.partial;
- messages.add(new ValidationMessage.error(
+ messages.add(ValidationMessage.error(
'ideviceinstaller is not installed; this is used to discover connected iOS devices.\n'
'To install, run:\n'
' brew install --HEAD libimobiledevice\n'
@@ -158,17 +158,17 @@
// Check ios-deploy is installed at meets version requirements.
if (await hasIosDeploy) {
- messages.add(new ValidationMessage('ios-deploy ${await iosDeployVersionText}'));
+ messages.add(ValidationMessage('ios-deploy ${await iosDeployVersionText}'));
}
if (!await _iosDeployIsInstalledAndMeetsVersionCheck) {
brewStatus = ValidationType.partial;
if (await hasIosDeploy) {
- messages.add(new ValidationMessage.error(
+ messages.add(ValidationMessage.error(
'ios-deploy out of date ($iosDeployMinimumVersion is required). To upgrade:\n'
' brew upgrade ios-deploy'
));
} else {
- messages.add(new ValidationMessage.error(
+ messages.add(ValidationMessage.error(
'ios-deploy not installed. To install:\n'
' brew install ios-deploy'
));
@@ -179,10 +179,10 @@
if (cocoaPodsStatus == CocoaPodsStatus.recommended) {
if (await cocoaPods.isCocoaPodsInitialized) {
- messages.add(new ValidationMessage('CocoaPods version ${await cocoaPods.cocoaPodsVersionText}'));
+ messages.add(ValidationMessage('CocoaPods version ${await cocoaPods.cocoaPodsVersionText}'));
} else {
brewStatus = ValidationType.partial;
- messages.add(new ValidationMessage.error(
+ messages.add(ValidationMessage.error(
'CocoaPods installed but not initialized.\n'
'$noCocoaPodsConsequence\n'
'To initialize CocoaPods, run:\n'
@@ -193,14 +193,14 @@
} else {
brewStatus = ValidationType.partial;
if (cocoaPodsStatus == CocoaPodsStatus.notInstalled) {
- messages.add(new ValidationMessage.error(
+ messages.add(ValidationMessage.error(
'CocoaPods not installed.\n'
'$noCocoaPodsConsequence\n'
'To install:\n'
'$cocoaPodsInstallInstructions'
));
} else {
- messages.add(new ValidationMessage.hint(
+ messages.add(ValidationMessage.hint(
'CocoaPods out of date (${cocoaPods.cocoaPodsRecommendedVersion} is recommended).\n'
'$noCocoaPodsConsequence\n'
'To upgrade:\n'
@@ -210,13 +210,13 @@
}
} else {
brewStatus = ValidationType.missing;
- messages.add(new ValidationMessage.error(
+ messages.add(ValidationMessage.error(
'Brew not installed; use this to install tools for iOS device development.\n'
'Download brew at https://brew.sh/.'
));
}
- return new ValidationResult(
+ return ValidationResult(
<ValidationType>[xcodeStatus, brewStatus].reduce(_mergeValidationTypes),
messages,
statusInfo: xcodeVersionInfo
diff --git a/packages/flutter_tools/lib/src/ios/mac.dart b/packages/flutter_tools/lib/src/ios/mac.dart
index 267961c..294d785 100644
--- a/packages/flutter_tools/lib/src/ios/mac.dart
+++ b/packages/flutter_tools/lib/src/ios/mac.dart
@@ -60,10 +60,10 @@
try {
final ProcessResult result = await processManager.run(<String>['idevice_id', '-l']);
if (result.exitCode != 0)
- throw new ToolExit('idevice_id returned an error:\n${result.stderr}');
+ throw ToolExit('idevice_id returned an error:\n${result.stderr}');
return result.stdout;
} on ProcessException {
- throw new ToolExit('Failed to invoke idevice_id. Run flutter doctor.');
+ throw ToolExit('Failed to invoke idevice_id. Run flutter doctor.');
}
}
@@ -71,10 +71,10 @@
try {
final ProcessResult result = await processManager.run(<String>['ideviceinfo', '-u', deviceID, '-k', key, '--simple']);
if (result.exitCode != 0)
- throw new ToolExit('idevice_id returned an error:\n${result.stderr}');
+ throw ToolExit('idevice_id returned an error:\n${result.stderr}');
return result.stdout.trim();
} on ProcessException {
- throw new ToolExit('Failed to invoke idevice_id. Run flutter doctor.');
+ throw ToolExit('Failed to invoke idevice_id. Run flutter doctor.');
}
}
@@ -190,17 +190,17 @@
bool usesTerminalUi = true,
}) async {
if (!await upgradePbxProjWithFlutterAssets(app.project))
- return new XcodeBuildResult(success: false);
+ return XcodeBuildResult(success: false);
if (!_checkXcodeVersion())
- return new XcodeBuildResult(success: false);
+ return XcodeBuildResult(success: false);
final XcodeProjectInfo projectInfo = xcodeProjectInterpreter.getInfo(app.project.directory.path);
if (!projectInfo.targets.contains('Runner')) {
printError('The Xcode project does not define target "Runner" which is needed by Flutter tooling.');
printError('Open Xcode to fix the problem:');
printError(' open ios/Runner.xcworkspace');
- return new XcodeBuildResult(success: false);
+ return XcodeBuildResult(success: false);
}
final String scheme = projectInfo.schemeFor(buildInfo);
if (scheme == null) {
@@ -212,7 +212,7 @@
printError('The Xcode project does not define custom schemes.');
printError('You cannot use the --flavor option.');
}
- return new XcodeBuildResult(success: false);
+ return XcodeBuildResult(success: false);
}
final String configuration = projectInfo.buildConfigurationFor(buildInfo, scheme);
if (configuration == null) {
@@ -221,7 +221,7 @@
printError('Flutter expects a build configuration named ${XcodeProjectInfo.expectedBuildConfigurationFor(buildInfo, scheme)} or similar.');
printError('Open Xcode to fix the problem:');
printError(' open ios/Runner.xcworkspace');
- return new XcodeBuildResult(success: false);
+ return XcodeBuildResult(success: false);
}
Map<String, String> autoSigningConfigs;
@@ -242,7 +242,7 @@
if (hasPlugins(project)) {
// If the Xcode project, Podfile, or Generated.xcconfig have changed since
// last run, pods should be updated.
- final Fingerprinter fingerprinter = new Fingerprinter(
+ final Fingerprinter fingerprinter = Fingerprinter(
fingerprintPath: fs.path.join(getIosBuildDirectory(), 'pod_inputs.fingerprint'),
paths: <String>[
app.project.xcodeProjectInfoFile.path,
@@ -346,7 +346,7 @@
buildCommands.add('SCRIPT_OUTPUT_STREAM_FILE=${scriptOutputPipeFile.absolute.path}');
}
- final Stopwatch buildStopwatch = new Stopwatch()..start();
+ final Stopwatch buildStopwatch = Stopwatch()..start();
initialBuildStatus = logger.startProgress('Starting Xcode build...');
final RunResult buildResult = await runAsync(
buildCommands,
@@ -366,7 +366,7 @@
// Run -showBuildSettings again but with the exact same parameters as the build.
final Map<String, String> buildSettings = parseXcodeBuildSettings(runCheckedSync(
- (new List<String>
+ (List<String>
.from(buildCommands)
..add('-showBuildSettings'))
// Undocumented behaviour: xcodebuild craps out if -showBuildSettings
@@ -391,11 +391,11 @@
printStatus('Xcode\'s output:\n↳');
printStatus(buildResult.stdout, indent: 4);
}
- return new XcodeBuildResult(
+ return XcodeBuildResult(
success: false,
stdout: buildResult.stdout,
stderr: buildResult.stderr,
- xcodeBuildExecution: new XcodeBuildExecution(
+ xcodeBuildExecution: XcodeBuildExecution(
buildCommands: buildCommands,
appDirectory: app.project.directory.path,
buildForPhysicalDevice: buildForDevice,
@@ -422,7 +422,7 @@
} else {
printError('Build succeeded but the expected app at $expectedOutputDirectory not found');
}
- return new XcodeBuildResult(success: true, output: outputDir);
+ return XcodeBuildResult(success: true, output: outputDir);
}
}
@@ -632,7 +632,7 @@
lines.remove(l12);
}
- final StringBuffer buffer = new StringBuffer();
+ final StringBuffer buffer = StringBuffer();
lines.forEach(buffer.writeln);
await xcodeProjectFile.writeAsString(buffer.toString());
return true;
diff --git a/packages/flutter_tools/lib/src/ios/simulators.dart b/packages/flutter_tools/lib/src/ios/simulators.dart
index 39c0cee..e4ba830 100644
--- a/packages/flutter_tools/lib/src/ios/simulators.dart
+++ b/packages/flutter_tools/lib/src/ios/simulators.dart
@@ -47,7 +47,7 @@
return <IOSSimulator>[];
return SimControl.instance.getConnectedDevices().map((SimDevice device) {
- return new IOSSimulator(device.udid, name: device.name, category: device.category);
+ return IOSSimulator(device.udid, name: device.name, category: device.category);
}).toList();
}
}
@@ -97,7 +97,7 @@
for (String deviceCategory in devicesSection.keys) {
final List<dynamic> devicesData = devicesSection[deviceCategory];
for (Map<String, dynamic> data in devicesData.map<Map<String, dynamic>>(castStringKeyedMap)) {
- devices.add(new SimDevice(deviceCategory, data));
+ devices.add(SimDevice(deviceCategory, data));
}
}
@@ -246,7 +246,7 @@
// Check if the device is part of a blacklisted category.
// We do not yet support WatchOS or tvOS devices.
- final RegExp blacklist = new RegExp(r'Apple (TV|Watch)', caseSensitive: false);
+ final RegExp blacklist = RegExp(r'Apple (TV|Watch)', caseSensitive: false);
if (blacklist.hasMatch(name)) {
_supportMessage = 'Flutter does not support Apple TV or Apple Watch.';
return false;
@@ -283,11 +283,11 @@
await _setupUpdatedApplicationBundle(package, debuggingOptions.buildInfo, mainPath, usesTerminalUi);
} on ToolExit catch (e) {
printError(e.message);
- return new LaunchResult.failed();
+ return LaunchResult.failed();
}
} else {
if (!await installApp(package))
- return new LaunchResult.failed();
+ return LaunchResult.failed();
}
// Prepare launch arguments.
@@ -308,7 +308,7 @@
ProtocolDiscovery observatoryDiscovery;
if (debuggingOptions.debuggingEnabled)
- observatoryDiscovery = new ProtocolDiscovery.observatory(
+ observatoryDiscovery = ProtocolDiscovery.observatory(
getLogReader(app: package), ipv6: ipv6);
// Launch the updated application in the simulator.
@@ -316,11 +316,11 @@
await SimControl.instance.launch(id, package.id, args);
} catch (error) {
printError('$error');
- return new LaunchResult.failed();
+ return LaunchResult.failed();
}
if (!debuggingOptions.debuggingEnabled) {
- return new LaunchResult.succeeded();
+ return LaunchResult.succeeded();
}
// Wait for the service protocol port here. This will complete once the
@@ -329,10 +329,10 @@
try {
final Uri deviceUri = await observatoryDiscovery.uri;
- return new LaunchResult.succeeded(observatoryUri: deviceUri);
+ return LaunchResult.succeeded(observatoryUri: deviceUri);
} catch (error) {
printError('Error waiting for a debug connection: $error');
- return new LaunchResult.failed();
+ return LaunchResult.failed();
} finally {
await observatoryDiscovery.cancel();
}
@@ -357,7 +357,7 @@
// Step 1: Build the Xcode project.
// The build mode for the simulator is always debug.
- final BuildInfo debugBuildInfo = new BuildInfo(BuildMode.debug, buildInfo.flavor,
+ final BuildInfo debugBuildInfo = BuildInfo(BuildMode.debug, buildInfo.flavor,
trackWidgetCreation: buildInfo.trackWidgetCreation,
extraFrontEndOptions: buildInfo.extraFrontEndOptions,
extraGenSnapshotOptions: buildInfo.extraGenSnapshotOptions,
@@ -411,7 +411,7 @@
@override
Future<String> get sdkNameAndVersion async => category;
- final RegExp _iosSdkRegExp = new RegExp(r'iOS( |-)(\d+)');
+ final RegExp _iosSdkRegExp = RegExp(r'iOS( |-)(\d+)');
Future<int> get sdkMajorVersion async {
final Match sdkMatch = _iosSdkRegExp.firstMatch(await sdkNameAndVersion);
@@ -422,11 +422,11 @@
DeviceLogReader getLogReader({ApplicationPackage app}) {
assert(app is IOSApp);
_logReaders ??= <ApplicationPackage, _IOSSimulatorLogReader>{};
- return _logReaders.putIfAbsent(app, () => new _IOSSimulatorLogReader(this, app));
+ return _logReaders.putIfAbsent(app, () => _IOSSimulatorLogReader(this, app));
}
@override
- DevicePortForwarder get portForwarder => _portForwarder ??= new _IOSSimulatorDevicePortForwarder(this);
+ DevicePortForwarder get portForwarder => _portForwarder ??= _IOSSimulatorDevicePortForwarder(this);
@override
void clearLogs() {
@@ -485,7 +485,7 @@
String _appName;
_IOSSimulatorLogReader(this.device, IOSApp app) {
- _linesController = new StreamController<String>.broadcast(
+ _linesController = StreamController<String>.broadcast(
onListen: _start,
onCancel: _stop
);
@@ -532,13 +532,13 @@
// Match the log prefix (in order to shorten it):
// * Xcode 8: Sep 13 15:28:51 cbracken-macpro localhost Runner[37195]: (Flutter) Observatory listening on http://127.0.0.1:57701/
// * Xcode 9: 2017-09-13 15:26:57.228948-0700 localhost Runner[37195]: (Flutter) Observatory listening on http://127.0.0.1:57701/
- static final RegExp _mapRegex = new RegExp(r'\S+ +\S+ +\S+ +(\S+ +)?(\S+)\[\d+\]\)?: (\(.*?\))? *(.*)$');
+ static final RegExp _mapRegex = RegExp(r'\S+ +\S+ +\S+ +(\S+ +)?(\S+)\[\d+\]\)?: (\(.*?\))? *(.*)$');
// Jan 31 19:23:28 --- last message repeated 1 time ---
- static final RegExp _lastMessageSingleRegex = new RegExp(r'\S+ +\S+ +\S+ --- last message repeated 1 time ---$');
- static final RegExp _lastMessageMultipleRegex = new RegExp(r'\S+ +\S+ +\S+ --- last message repeated (\d+) times ---$');
+ static final RegExp _lastMessageSingleRegex = RegExp(r'\S+ +\S+ +\S+ --- last message repeated 1 time ---$');
+ static final RegExp _lastMessageMultipleRegex = RegExp(r'\S+ +\S+ +\S+ --- last message repeated (\d+) times ---$');
- static final RegExp _flutterRunnerRegex = new RegExp(r' FlutterRunner\[\d+\] ');
+ static final RegExp _flutterRunnerRegex = RegExp(r' FlutterRunner\[\d+\] ');
String _filterDeviceLine(String string) {
final Match match = _mapRegex.matchAsPrefix(string);
@@ -579,7 +579,7 @@
if (_lastMessageSingleRegex.matchAsPrefix(string) != null)
return null;
- if (new RegExp(r'assertion failed: .* libxpc.dylib .* 0x7d$').matchAsPrefix(string) != null)
+ if (RegExp(r'assertion failed: .* libxpc.dylib .* 0x7d$').matchAsPrefix(string) != null)
return null;
return string;
@@ -652,7 +652,7 @@
/// ✗ com.apple.CoreSimulator.SimDeviceType.iPad-2
/// ✗ com.apple.CoreSimulator.SimDeviceType.Apple-Watch-38mm
final RegExp _iosDeviceTypePattern =
- new RegExp(r'com.apple.CoreSimulator.SimDeviceType.iPhone-(\d+)(.*)');
+ RegExp(r'com.apple.CoreSimulator.SimDeviceType.iPhone-(\d+)(.*)');
int compareIphoneVersions(String id1, String id2) {
final Match m1 = _iosDeviceTypePattern.firstMatch(id1);
@@ -690,7 +690,7 @@
hostPort = devicePort;
}
assert(devicePort == hostPort);
- _ports.add(new ForwardedPort(devicePort, hostPort));
+ _ports.add(ForwardedPort(devicePort, hostPort));
return hostPort;
}
diff --git a/packages/flutter_tools/lib/src/ios/xcodeproj.dart b/packages/flutter_tools/lib/src/ios/xcodeproj.dart
index 584f66b..9e63865 100644
--- a/packages/flutter_tools/lib/src/ios/xcodeproj.dart
+++ b/packages/flutter_tools/lib/src/ios/xcodeproj.dart
@@ -19,8 +19,8 @@
import '../globals.dart';
import '../project.dart';
-final RegExp _settingExpr = new RegExp(r'(\w+)\s*=\s*(.*)$');
-final RegExp _varExpr = new RegExp(r'\$\(([^)]*)\)');
+final RegExp _settingExpr = RegExp(r'(\w+)\s*=\s*(.*)$');
+final RegExp _varExpr = RegExp(r'\$\(([^)]*)\)');
String flutterFrameworkDir(BuildMode mode) {
return fs.path.normalize(fs.path.dirname(artifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.ios, mode)));
@@ -35,7 +35,7 @@
@required BuildInfo buildInfo,
String targetOverride,
}) async {
- final StringBuffer localsBuffer = new StringBuffer();
+ final StringBuffer localsBuffer = StringBuffer();
localsBuffer.writeln('// This is a generated file; do not edit or check into version control.');
@@ -102,7 +102,7 @@
/// Interpreter of Xcode projects.
class XcodeProjectInterpreter {
static const String _executable = '/usr/bin/xcodebuild';
- static final RegExp _versionRegex = new RegExp(r'Xcode ([0-9.]+)');
+ static final RegExp _versionRegex = RegExp(r'Xcode ([0-9.]+)');
void _updateVersion() {
if (!platform.isMacOS || !fs.file(_executable).existsSync()) {
@@ -165,7 +165,7 @@
final String out = runCheckedSync(<String>[
_executable, '-list',
], workingDirectory: projectPath);
- return new XcodeProjectInfo.fromXcodeBuildOutput(out);
+ return XcodeProjectInfo.fromXcodeBuildOutput(out);
}
}
@@ -218,7 +218,7 @@
}
if (schemes.isEmpty)
schemes.add('Runner');
- return new XcodeProjectInfo(targets, buildConfigurations, schemes);
+ return XcodeProjectInfo(targets, buildConfigurations, schemes);
}
final List<String> targets;
diff --git a/packages/flutter_tools/lib/src/plugins.dart b/packages/flutter_tools/lib/src/plugins.dart
index 288d87a..ea5f798 100644
--- a/packages/flutter_tools/lib/src/plugins.dart
+++ b/packages/flutter_tools/lib/src/plugins.dart
@@ -15,7 +15,7 @@
void _renderTemplateToFile(String template, dynamic context, String filePath) {
final String renderedTemplate =
- new mustache.Template(template).renderString(context);
+ mustache.Template(template).renderString(context);
final File file = fs.file(filePath);
file.createSync(recursive: true);
file.writeAsStringSync(renderedTemplate);
@@ -45,7 +45,7 @@
iosPrefix = pluginYaml['iosPrefix'] ?? '';
pluginClass = pluginYaml['pluginClass'];
}
- return new Plugin(
+ return Plugin(
name: name,
path: path,
androidPackage: androidPackage,
@@ -67,7 +67,7 @@
return null;
final String packageRootPath = fs.path.fromUri(packageRoot);
printTrace('Found plugin $name at $packageRootPath');
- return new Plugin.fromYaml(name, packageRootPath, flutterConfig['plugin']);
+ return Plugin.fromYaml(name, packageRootPath, flutterConfig['plugin']);
}
List<Plugin> findPlugins(FlutterProject project) {
@@ -75,7 +75,7 @@
Map<String, Uri> packages;
try {
final String packagesFile = fs.path.join(project.directory.path, PackageMap.globalPackagesPath);
- packages = new PackageMap(packagesFile).map;
+ packages = PackageMap(packagesFile).map;
} on FormatException catch (e) {
printTrace('Invalid .packages file: $e');
return plugins;
@@ -297,7 +297,7 @@
await _writeAndroidPluginRegistrant(project, plugins);
await _writeIOSPluginRegistrant(project, plugins);
if (!project.isModule && project.ios.directory.existsSync()) {
- final CocoaPods cocoaPods = new CocoaPods();
+ final CocoaPods cocoaPods = CocoaPods();
if (plugins.isNotEmpty)
cocoaPods.setupPodfile(project.ios);
}
diff --git a/packages/flutter_tools/lib/src/project.dart b/packages/flutter_tools/lib/src/project.dart
index ce8779c..6f11e05 100644
--- a/packages/flutter_tools/lib/src/project.dart
+++ b/packages/flutter_tools/lib/src/project.dart
@@ -45,7 +45,7 @@
final FlutterManifest exampleManifest = await _readManifest(
_exampleDirectory(directory).childFile(bundle.defaultManifestPath).path,
);
- return new FlutterProject(directory, manifest, exampleManifest);
+ return FlutterProject(directory, manifest, exampleManifest);
}
/// Returns a future that completes with a [FlutterProject] view of the current directory.
@@ -76,7 +76,7 @@
example.android.applicationId,
example.ios.productBundleIdentifier,
];
- return new Set<String>.from(candidates
+ return Set<String>.from(candidates
.map(_organizationNameFromPackageName)
.where((String name) => name != null));
}
@@ -89,10 +89,10 @@
}
/// The iOS sub project of this project.
- IosProject get ios => new IosProject._(this);
+ IosProject get ios => IosProject._(this);
/// The Android sub project of this project.
- AndroidProject get android => new AndroidProject._(this);
+ AndroidProject get android => AndroidProject._(this);
/// The `pubspec.yaml` file of this project.
File get pubspecFile => directory.childFile('pubspec.yaml');
@@ -104,7 +104,7 @@
File get flutterPluginsFile => directory.childFile('.flutter-plugins');
/// The example sub-project of this project.
- FlutterProject get example => new FlutterProject(
+ FlutterProject get example => FlutterProject(
_exampleDirectory(directory),
_exampleManifest,
FlutterManifest.empty(),
@@ -148,7 +148,7 @@
/// Instances will reflect the contents of the `ios/` sub-folder of
/// Flutter applications and the `.ios/` sub-folder of Flutter modules.
class IosProject {
- static final RegExp _productBundleIdPattern = new RegExp(r'^\s*PRODUCT_BUNDLE_IDENTIFIER\s*=\s*(.*);\s*$');
+ static final RegExp _productBundleIdPattern = RegExp(r'^\s*PRODUCT_BUNDLE_IDENTIFIER\s*=\s*(.*);\s*$');
static const String _productBundleIdVariable = r'$(PRODUCT_BUNDLE_IDENTIFIER)';
static const String _hostAppBundleName = 'Runner';
@@ -262,7 +262,7 @@
}
void _overwriteFromTemplate(String path, Directory target) {
- final Template template = new Template.fromName(path);
+ final Template template = Template.fromName(path);
template.render(
target,
<String, dynamic>{
@@ -280,8 +280,8 @@
/// Instances will reflect the contents of the `android/` sub-folder of
/// Flutter applications and the `.android/` sub-folder of Flutter modules.
class AndroidProject {
- static final RegExp _applicationIdPattern = new RegExp('^\\s*applicationId\\s+[\'\"](.*)[\'\"]\\s*\$');
- static final RegExp _groupPattern = new RegExp('^\\s*group\\s+[\'\"](.*)[\'\"]\\s*\$');
+ static final RegExp _applicationIdPattern = RegExp('^\\s*applicationId\\s+[\'\"](.*)[\'\"]\\s*\$');
+ static final RegExp _groupPattern = RegExp('^\\s*group\\s+[\'\"](.*)[\'\"]\\s*\$');
AndroidProject._(this.parent);
@@ -379,7 +379,7 @@
}
void _overwriteFromTemplate(String path, Directory target) {
- final Template template = new Template.fromName(path);
+ final Template template = Template.fromName(path);
template.render(
target,
<String, dynamic>{
diff --git a/packages/flutter_tools/lib/src/protocol_discovery.dart b/packages/flutter_tools/lib/src/protocol_discovery.dart
index ca3ee11..ff6664a 100644
--- a/packages/flutter_tools/lib/src/protocol_discovery.dart
+++ b/packages/flutter_tools/lib/src/protocol_discovery.dart
@@ -28,7 +28,7 @@
bool ipv6 = false,
}) {
const String kObservatoryService = 'Observatory';
- return new ProtocolDiscovery._(
+ return ProtocolDiscovery._(
logReader,
kObservatoryService,
portForwarder: portForwarder,
@@ -43,7 +43,7 @@
final int hostPort;
final bool ipv6;
- final Completer<Uri> _completer = new Completer<Uri>();
+ final Completer<Uri> _completer = Completer<Uri>();
StreamSubscription<String> _deviceLogSubscription;
@@ -60,7 +60,7 @@
void _handleLine(String line) {
Uri uri;
- final RegExp r = new RegExp('${RegExp.escape(serviceName)} listening on ((http|\/\/)[a-zA-Z0-9:/=\.\\[\\]]+)');
+ final RegExp r = RegExp('${RegExp.escape(serviceName)} listening on ((http|\/\/)[a-zA-Z0-9:/=\.\\[\\]]+)');
final Match match = r.firstMatch(line);
if (match != null) {
@@ -91,7 +91,7 @@
hostUri = deviceUri.replace(port: actualHostPort);
}
- assert(new InternetAddress(hostUri.host).isLoopback);
+ assert(InternetAddress(hostUri.host).isLoopback);
if (ipv6) {
hostUri = hostUri.replace(host: InternetAddress.loopbackIPv6.host);
}
diff --git a/packages/flutter_tools/lib/src/resident_runner.dart b/packages/flutter_tools/lib/src/resident_runner.dart
index 57c4569..d2706b8 100644
--- a/packages/flutter_tools/lib/src/resident_runner.dart
+++ b/packages/flutter_tools/lib/src/resident_runner.dart
@@ -35,7 +35,7 @@
this.fileSystemRoots,
this.fileSystemScheme,
ResidentCompiler generator,
- }) : this.generator = generator ?? new ResidentCompiler(
+ }) : this.generator = generator ?? ResidentCompiler(
artifacts.getArtifactPath(Artifact.flutterPatchedSdkPath),
trackWidgetCreation: trackWidgetCreation,
fileSystemRoots: fileSystemRoots, fileSystemScheme: fileSystemScheme
@@ -65,7 +65,7 @@
Future<Null> _connect({ReloadSources reloadSources, CompileExpression compileExpression}) async {
if (vmServices != null)
return;
- final List<VMService> localVmServices = new List<VMService>(observatoryUris.length);
+ final List<VMService> localVmServices = List<VMService>(observatoryUris.length);
for (int i = 0; i < observatoryUris.length; i++) {
printTrace('Connecting to service protocol: ${observatoryUris[i]}');
localVmServices[i] = await VMService.connect(observatoryUris[i],
@@ -116,7 +116,7 @@
view.uiIsolate.flutterExit(); // ignore: unawaited_futures
}
}
- await new Future<Null>.delayed(const Duration(milliseconds: 100));
+ await Future<Null>.delayed(const Duration(milliseconds: 100));
}
Future<Uri> setupDevFS(String fsName,
@@ -124,7 +124,7 @@
String packagesFilePath
}) {
// One devFS per device. Shared by all running instances.
- devFS = new DevFS(
+ devFS = DevFS(
vmServices[0],
fsName,
rootDirectory,
@@ -170,7 +170,7 @@
final List<ProgramElement> elements = <ProgramElement>[];
for (Future<List<ProgramElement>> report in reports) {
for (ProgramElement element in await report)
- elements.add(new ProgramElement(element.qualifiedName,
+ elements.add(ProgramElement(element.qualifiedName,
devFS.deviceUriToHostUri(element.uri),
element.line,
element.column));
@@ -439,7 +439,7 @@
final bool usesTerminalUI;
final bool stayResident;
final bool ipv6;
- final Completer<int> _finished = new Completer<int>();
+ final Completer<int> _finished = Completer<int>();
bool _stopped = false;
String _packagesFilePath;
String get packagesFilePath => _packagesFilePath;
@@ -627,7 +627,7 @@
Future<Null> connectToServiceProtocol({String viewFilter,
ReloadSources reloadSources, CompileExpression compileExpression}) async {
if (!debuggingOptions.debuggingEnabled)
- return new Future<Null>.error('Error the service protocol is not enabled.');
+ return Future<Null>.error('Error the service protocol is not enabled.');
bool viewFound = false;
for (FlutterDevice device in flutterDevices) {
@@ -660,12 +660,12 @@
Future<Null> _serviceProtocolDone(dynamic object) {
printTrace('Service protocol connection closed.');
- return new Future<Null>.value(object);
+ return Future<Null>.value(object);
}
Future<Null> _serviceProtocolError(dynamic error, StackTrace stack) {
printTrace('Service protocol connection closed with an error: $error\n$stack');
- return new Future<Null>.error(error, stack);
+ return Future<Null>.error(error, stack);
}
/// Returns [true] if the input has been handled by this function.
@@ -805,9 +805,9 @@
bool hasDirtyDependencies(FlutterDevice device) {
final DartDependencySetBuilder dartDependencySetBuilder =
- new DartDependencySetBuilder(mainPath, packagesFilePath);
+ DartDependencySetBuilder(mainPath, packagesFilePath);
final DependencyChecker dependencyChecker =
- new DependencyChecker(dartDependencySetBuilder, assetBundle);
+ DependencyChecker(dartDependencySetBuilder, assetBundle);
if (device.package.packagesFile == null || !device.package.packagesFile.existsSync()) {
return true;
}
@@ -876,7 +876,7 @@
bool get isOk => code == 0;
- static final OperationResult ok = new OperationResult(0, '');
+ static final OperationResult ok = OperationResult(0, '');
}
/// Given the value of the --target option, return the path of the Dart file
diff --git a/packages/flutter_tools/lib/src/run_cold.dart b/packages/flutter_tools/lib/src/run_cold.dart
index a7fddb2..18a12c5 100644
--- a/packages/flutter_tools/lib/src/run_cold.dart
+++ b/packages/flutter_tools/lib/src/run_cold.dart
@@ -66,7 +66,7 @@
if (flutterDevices.first.observatoryUris != null) {
// For now, only support one debugger connection.
- connectionInfoCompleter?.complete(new DebugConnectionInfo(
+ connectionInfoCompleter?.complete(DebugConnectionInfo(
httpUri: flutterDevices.first.observatoryUris.first,
wsUri: flutterDevices.first.vmServices.first.wsAddress,
));
diff --git a/packages/flutter_tools/lib/src/run_hot.dart b/packages/flutter_tools/lib/src/run_hot.dart
index 40a3340..f1c1a50 100644
--- a/packages/flutter_tools/lib/src/run_hot.dart
+++ b/packages/flutter_tools/lib/src/run_hot.dart
@@ -106,9 +106,9 @@
}
final DartDependencySetBuilder dartDependencySetBuilder =
- new DartDependencySetBuilder(mainPath, packagesFilePath);
+ DartDependencySetBuilder(mainPath, packagesFilePath);
try {
- _dartDependencies = new Set<String>.from(dartDependencySetBuilder.build());
+ _dartDependencies = Set<String>.from(dartDependencySetBuilder.build());
} on DartDependencyException catch (error) {
printError(
'Your application could not be compiled, because its dependencies could not be established.\n'
@@ -124,7 +124,7 @@
// TODO(cbernaschina): check that isolateId is the id of the UI isolate.
final OperationResult result = await restart(pauseAfterRestart: pause);
if (!result.isOk) {
- throw new rpc.RpcException(
+ throw rpc.RpcException(
rpc_error_code.INTERNAL_ERROR,
'Unable to reload sources',
);
@@ -170,7 +170,7 @@
if (connectionInfoCompleter != null) {
// Only handle one debugger connection.
connectionInfoCompleter.complete(
- new DebugConnectionInfo(
+ DebugConnectionInfo(
httpUri: flutterDevices.first.observatoryUris.first,
wsUri: flutterDevices.first.vmServices.first.wsAddress,
baseUri: baseUris.first.toString()
@@ -181,7 +181,7 @@
printError('Error initializing DevFS: $error');
return 3;
}
- final Stopwatch initialUpdateDevFSsTimer = new Stopwatch()..start();
+ final Stopwatch initialUpdateDevFSsTimer = Stopwatch()..start();
final bool devfsResult = await _updateDevFS(fullRestart: true);
_addBenchmarkData('hotReloadInitialDevFSSyncMilliseconds',
initialUpdateDevFSsTimer.elapsed.inMilliseconds);
@@ -255,7 +255,7 @@
return 1;
}
- firstBuildTime = new DateTime.now();
+ firstBuildTime = DateTime.now();
for (FlutterDevice device in flutterDevices) {
final int result = await device.runHot(
@@ -404,7 +404,7 @@
await refreshViews();
}
- final Stopwatch restartTimer = new Stopwatch()..start();
+ final Stopwatch restartTimer = Stopwatch()..start();
// TODO(aam): Add generator reset logic once we switch to using incremental
// compiler for full application recompilation on restart.
final bool updatedDevFS = await _updateDevFS(fullRestart: true);
@@ -413,7 +413,7 @@
if (device.generator != null)
device.generator.reject();
}
- return new OperationResult(1, 'DevFS synchronization failed');
+ return OperationResult(1, 'DevFS synchronization failed');
}
_resetDirtyAssets();
for (FlutterDevice device in flutterDevices) {
@@ -492,7 +492,7 @@
@override
Future<OperationResult> restart({ bool fullRestart = false, bool pauseAfterRestart = false }) async {
- final Stopwatch timer = new Stopwatch()..start();
+ final Stopwatch timer = Stopwatch()..start();
if (fullRestart) {
final Status status = logger.startProgress(
'Performing hot restart...',
@@ -500,7 +500,7 @@
);
try {
if (!(await hotRunnerConfig.setupHotRestart()))
- return new OperationResult(1, 'setupHotRestart failed');
+ return OperationResult(1, 'setupHotRestart failed');
await _restartFromSources();
} finally {
status.cancel();
@@ -548,23 +548,23 @@
// not be affected, so we resume reporting reload times on the second
// reload.
final bool shouldReportReloadTime = !_runningFromSnapshot;
- final Stopwatch reloadTimer = new Stopwatch()..start();
+ final Stopwatch reloadTimer = Stopwatch()..start();
- final Stopwatch devFSTimer = new Stopwatch()..start();
+ final Stopwatch devFSTimer = Stopwatch()..start();
final bool updatedDevFS = await _updateDevFS();
// Record time it took to synchronize to DevFS.
_addBenchmarkData('hotReloadDevFSSyncMilliseconds',
devFSTimer.elapsed.inMilliseconds);
if (!updatedDevFS)
- return new OperationResult(1, 'DevFS synchronization failed');
+ return OperationResult(1, 'DevFS synchronization failed');
String reloadMessage;
- final Stopwatch vmReloadTimer = new Stopwatch()..start();
+ final Stopwatch vmReloadTimer = Stopwatch()..start();
try {
final String entryPath = fs.path.relative(
getReloadPath(fullRestart: false),
from: projectRootPath,
);
- final Completer<Map<String, dynamic>> retrieveFirstReloadReport = new Completer<Map<String, dynamic>>();
+ final Completer<Map<String, dynamic>> retrieveFirstReloadReport = Completer<Map<String, dynamic>>();
int countExpectedReports = 0;
for (FlutterDevice device in flutterDevices) {
@@ -606,13 +606,13 @@
if (countExpectedReports == 0) {
printError('Unable to hot reload. No instance of Flutter is currently running.');
- return new OperationResult(1, 'No instances running');
+ return OperationResult(1, 'No instances running');
}
final Map<String, dynamic> reloadReport = await retrieveFirstReloadReport.future;
if (!validateReloadReport(reloadReport)) {
// Reload failed.
flutterUsage.sendEvent('hot', 'reload-reject');
- return new OperationResult(1, 'Reload rejected');
+ return OperationResult(1, 'Reload rejected');
} else {
flutterUsage.sendEvent('hot', 'reload');
final int loadedLibraryCount = reloadReport['details']['loadedLibraryCount'];
@@ -631,19 +631,19 @@
'restart the app.'
);
flutterUsage.sendEvent('hot', 'reload-barred');
- return new OperationResult(errorCode, errorMessage);
+ return OperationResult(errorCode, errorMessage);
}
printError('Hot reload failed:\ncode = $errorCode\nmessage = $errorMessage\n$st');
- return new OperationResult(errorCode, errorMessage);
+ return OperationResult(errorCode, errorMessage);
} catch (error, st) {
printError('Hot reload failed: $error\n$st');
- return new OperationResult(1, '$error');
+ return OperationResult(1, '$error');
}
// Record time it took for the VM to reload the sources.
_addBenchmarkData('hotReloadVMReloadMilliseconds',
vmReloadTimer.elapsed.inMilliseconds);
- final Stopwatch reassembleTimer = new Stopwatch()..start();
+ final Stopwatch reassembleTimer = Stopwatch()..start();
// Reload the isolate.
for (FlutterDevice device in flutterDevices) {
printTrace('Sending reload events to ${device.device.name}');
@@ -671,7 +671,7 @@
}
if (reassembleViews.isEmpty) {
printTrace('Skipping reassemble because all isolates are paused.');
- return new OperationResult(OperationResult.ok.code, reloadMessage);
+ return OperationResult(OperationResult.ok.code, reloadMessage);
}
printTrace('Evicting dirty assets');
await _evictDirtyAssets();
@@ -716,7 +716,7 @@
shouldReportReloadTime)
flutterUsage.sendTiming('hot', 'reload', reloadTimer.elapsed);
- return new OperationResult(
+ return OperationResult(
reassembleAndScheduleErrors ? 1 : OperationResult.ok.code,
reloadMessage,
);
diff --git a/packages/flutter_tools/lib/src/runner/flutter_command.dart b/packages/flutter_tools/lib/src/runner/flutter_command.dart
index c7fffcd..824d461 100644
--- a/packages/flutter_tools/lib/src/runner/flutter_command.dart
+++ b/packages/flutter_tools/lib/src/runner/flutter_command.dart
@@ -73,7 +73,7 @@
@override
ArgParser get argParser => _argParser;
- final ArgParser _argParser = new ArgParser(allowTrailingOptions: false);
+ final ArgParser _argParser = ArgParser(allowTrailingOptions: false);
@override
FlutterCommandRunner get runner => super.runner;
@@ -192,7 +192,7 @@
BuildMode getBuildMode() {
final 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 can be specified.', null);
+ throw UsageException('Only one of --debug, --profile, or --release can be specified.', null);
final bool dynamicFlag = argParser.options.containsKey('dynamic')
? argResults['dynamic']
: false;
@@ -231,11 +231,11 @@
? int.parse(argResults['build-number'])
: null;
} catch (e) {
- throw new UsageException(
+ throw UsageException(
'--build-number (${argResults['build-number']}) must be an int.', null);
}
- return new BuildInfo(getBuildMode(),
+ return BuildInfo(getBuildMode(),
argParser.options.containsKey('flavor')
? argResults['flavor']
: null,
@@ -265,7 +265,7 @@
}
void setupApplicationPackages() {
- applicationPackages ??= new ApplicationPackageStore();
+ applicationPackages ??= ApplicationPackageStore();
}
/// The path to send to Google Analytics. Return null here to disable
@@ -452,7 +452,7 @@
if (_requiresPubspecYaml && !PackageMap.isUsingCustomPackagesPath) {
// Don't expect a pubspec.yaml file if the user passed in an explicit .packages file path.
if (!fs.isFileSync('pubspec.yaml')) {
- throw new ToolExit(
+ throw ToolExit(
'Error: No pubspec.yaml file found.\n'
'This command should be run from the root of your Flutter project.\n'
'Do not run this command from the root of your git clone of Flutter.'
@@ -460,7 +460,7 @@
}
if (fs.isFileSync('flutter.yaml')) {
- throw new ToolExit(
+ throw ToolExit(
'Please merge your flutter.yaml into your pubspec.yaml.\n\n'
'We have changed from having separate flutter.yaml and pubspec.yaml\n'
'files to having just one pubspec.yaml file. Transitioning is simple:\n'
@@ -479,16 +479,16 @@
// Validate the current package map only if we will not be running "pub get" later.
if (parent?.name != 'packages' && !(_usesPubOption && argResults['pub'])) {
- final String error = new PackageMap(PackageMap.globalPackagesPath).checkValid();
+ final String error = PackageMap(PackageMap.globalPackagesPath).checkValid();
if (error != null)
- throw new ToolExit(error);
+ throw ToolExit(error);
}
}
if (_usesTargetOption) {
final String targetPath = targetFile;
if (!fs.isFileSync(targetPath))
- throw new ToolExit('Target file "$targetPath" not found.');
+ throw ToolExit('Target file "$targetPath" not found.');
}
final bool dynamicFlag = argParser.options.containsKey('dynamic')
@@ -496,9 +496,9 @@
final String compilationTraceFilePath = argParser.options.containsKey('precompile')
? argResults['precompile'] : null;
if (compilationTraceFilePath != null && getBuildMode() == BuildMode.debug)
- throw new ToolExit('Error: --precompile is not allowed when --debug is specified.');
+ throw ToolExit('Error: --precompile is not allowed when --debug is specified.');
if (compilationTraceFilePath != null && !dynamicFlag)
- throw new ToolExit('Error: --precompile is allowed only when --dynamic is specified.');
+ throw ToolExit('Error: --precompile is allowed only when --dynamic is specified.');
}
ApplicationPackageStore applicationPackages;
diff --git a/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart b/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
index 454fac9..b0ef55b 100644
--- a/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
+++ b/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
@@ -146,7 +146,7 @@
@override
ArgParser get argParser => _argParser;
- final ArgParser _argParser = new ArgParser(allowTrailingOptions: false);
+ final ArgParser _argParser = ArgParser(allowTrailingOptions: false);
@override
String get usageFooter {
@@ -214,13 +214,13 @@
@override
Future<Null> runCommand(ArgResults topLevelResults) async {
final Map<Type, dynamic> contextOverrides = <Type, dynamic>{
- Flags: new Flags(topLevelResults),
+ Flags: Flags(topLevelResults),
};
// Check for verbose.
if (topLevelResults['verbose']) {
// Override the logger.
- contextOverrides[Logger] = new VerboseLogger(logger);
+ contextOverrides[Logger] = VerboseLogger(logger);
}
if (topLevelResults['show-test-device'] ||
@@ -240,7 +240,7 @@
// Record the arguments that were used to invoke this runner.
final File manifest = tempDir.childFile('MANIFEST.txt');
- final StringBuffer buffer = new StringBuffer()
+ final StringBuffer buffer = StringBuffer()
..writeln('# arguments')
..writeln(topLevelResults.arguments)
..writeln()
@@ -302,7 +302,7 @@
await context.run<Null>(
overrides: contextOverrides.map<Type, Generator>((Type type, dynamic value) {
- return new MapEntry<Type, Generator>(type, () => value);
+ return MapEntry<Type, Generator>(type, () => value);
}),
body: () async {
logger.quiet = topLevelResults['quiet'];
@@ -360,7 +360,7 @@
if (engineSourcePath == null && globalResults['local-engine'] != null) {
try {
- final Uri engineUri = new PackageMap(PackageMap.globalPackagesPath).map[kFlutterEnginePackageName];
+ final Uri engineUri = PackageMap(PackageMap.globalPackagesPath).map[kFlutterEnginePackageName];
if (engineUri != null) {
engineSourcePath = fs.path.dirname(fs.path.dirname(fs.path.dirname(fs.path.dirname(engineUri.path))));
final bool dirExists = fs.isDirectorySync(fs.path.join(engineSourcePath, 'out'));
@@ -414,7 +414,7 @@
final String hostBasename = 'host_' + basename.replaceFirst('_sim_', '_').substring(basename.indexOf('_') + 1);
final String engineHostBuildPath = fs.path.normalize(fs.path.join(fs.path.dirname(engineBuildPath), hostBasename));
- return new EngineBuildPaths(targetEngine: engineBuildPath, hostEngine: engineHostBuildPath);
+ return EngineBuildPaths(targetEngine: engineBuildPath, hostEngine: engineHostBuildPath);
}
static void initFlutterRoot() {
@@ -485,7 +485,7 @@
// Check that the flutter running is that same as the one referenced in the pubspec.
if (fs.isFileSync(kPackagesFileName)) {
- final PackageMap packageMap = new PackageMap(kPackagesFileName);
+ final PackageMap packageMap = PackageMap(kPackagesFileName);
final Uri flutterUri = packageMap.map['flutter'];
if (flutterUri != null && (flutterUri.scheme == 'file' || flutterUri.scheme == '')) {
diff --git a/packages/flutter_tools/lib/src/services.dart b/packages/flutter_tools/lib/src/services.dart
index 5668efc..2edceb7 100644
--- a/packages/flutter_tools/lib/src/services.dart
+++ b/packages/flutter_tools/lib/src/services.dart
@@ -30,7 +30,7 @@
) async {
Map<String, Uri> packageMap;
try {
- packageMap = new PackageMap(PackageMap.globalPackagesPath).map;
+ packageMap = PackageMap(PackageMap.globalPackagesPath).map;
} on FormatException catch (error) {
printTrace('Invalid ".packages" file while parsing service configs:\n$error');
return;
diff --git a/packages/flutter_tools/lib/src/template.dart b/packages/flutter_tools/lib/src/template.dart
index ab99858..97bc18b 100644
--- a/packages/flutter_tools/lib/src/template.dart
+++ b/packages/flutter_tools/lib/src/template.dart
@@ -53,12 +53,12 @@
factory Template.fromName(String name) {
// All named templates are placed in the 'templates' directory
final Directory templateDir = templateDirectoryInPackage(name);
- return new Template(templateDir, templateDir);
+ return Template(templateDir, templateDir);
}
static const String templateExtension = '.tmpl';
static const String copyTemplateExtension = '.copy.tmpl';
- final Pattern _kTemplateLanguageVariant = new RegExp(r'(\w+)-(\w+)\.tmpl.*');
+ final Pattern _kTemplateLanguageVariant = RegExp(r'(\w+)-(\w+)\.tmpl.*');
Map<String /* relative */, String /* absolute source */> _templateFilePaths;
@@ -154,7 +154,7 @@
if (sourceFile.path.endsWith(templateExtension)) {
final String templateContents = sourceFile.readAsStringSync();
- final String renderedContents = new mustache.Template(templateContents).renderString(context);
+ final String renderedContents = mustache.Template(templateContents).renderString(context);
finalDestinationFile.writeAsStringSync(renderedContents);
diff --git a/packages/flutter_tools/lib/src/test/coverage_collector.dart b/packages/flutter_tools/lib/src/test/coverage_collector.dart
index a86b255..8d16526 100644
--- a/packages/flutter_tools/lib/src/test/coverage_collector.dart
+++ b/packages/flutter_tools/lib/src/test/coverage_collector.dart
@@ -50,18 +50,18 @@
Map<String, dynamic> data;
final Future<void> processComplete = process.exitCode
.then<void>((int code) {
- throw new Exception('Failed to collect coverage, process terminated prematurely with exit code $code.');
+ throw Exception('Failed to collect coverage, process terminated prematurely with exit code $code.');
});
final Future<void> collectionComplete = coverage.collect(observatoryUri, false, false)
.then<void>((Map<String, dynamic> result) {
if (result == null)
- throw new Exception('Failed to collect coverage.');
+ throw Exception('Failed to collect coverage.');
data = result;
})
.timeout(
const Duration(minutes: 10),
onTimeout: () {
- throw new Exception('Timed out while collecting coverage.');
+ throw Exception('Timed out while collecting coverage.');
},
);
await Future.any<void>(<Future<void>>[ processComplete, collectionComplete ]);
@@ -88,10 +88,10 @@
if (_globalHitmap == null)
return null;
if (formatter == null) {
- final coverage.Resolver resolver = new coverage.Resolver(packagesPath: PackageMap.globalPackagesPath);
+ final coverage.Resolver resolver = coverage.Resolver(packagesPath: PackageMap.globalPackagesPath);
final String packagePath = fs.currentDirectory.path;
final List<String> reportOn = <String>[fs.path.join(packagePath, 'lib')];
- formatter = new coverage.LcovFormatter(resolver, reportOn: reportOn, basePath: packagePath);
+ formatter = coverage.LcovFormatter(resolver, reportOn: reportOn, basePath: packagePath);
}
final String result = await formatter.format(_globalHitmap);
_globalHitmap = null;
diff --git a/packages/flutter_tools/lib/src/test/flutter_platform.dart b/packages/flutter_tools/lib/src/test/flutter_platform.dart
index 9538df9..7e171d5 100644
--- a/packages/flutter_tools/lib/src/test/flutter_platform.dart
+++ b/packages/flutter_tools/lib/src/test/flutter_platform.dart
@@ -80,7 +80,7 @@
assert(!enableObservatory || (!startPaused && observatoryPort == null));
hack.registerPlatformPlugin(
<Runtime>[Runtime.vm],
- () => new _FlutterPlatform(
+ () => _FlutterPlatform(
shellPath: shellPath,
watcher: watcher,
machine: machine,
@@ -128,7 +128,7 @@
: 'ws://[${host.address}]';
final String encodedWebsocketUrl = Uri.encodeComponent(websocketUrl);
- final StringBuffer buffer = new StringBuffer();
+ final StringBuffer buffer = StringBuffer();
buffer.write('''
import 'dart:convert';
import 'dart:io'; // ignore: dart_io_import
@@ -147,7 +147,7 @@
);
if (testConfigFile != null) {
buffer.write('''
-import '${new Uri.file(testConfigFile.path)}' as test_config;
+import '${Uri.file(testConfigFile.path)}' as test_config;
'''
);
}
@@ -229,7 +229,7 @@
final String testFilePath = fs.path.join(fs.path.fromUri(projectRootDirectory), getBuildDirectory(), 'testfile.dill');
ResidentCompiler createCompiler() {
- return new ResidentCompiler(
+ return ResidentCompiler(
artifacts.getArtifactPath(Artifact.flutterPatchedSdkPath),
packagesPath: PackageMap.globalPackagesPath,
trackWidgetCreation: trackWidgetCreation,
@@ -249,7 +249,7 @@
while (compilationQueue.isNotEmpty) {
final _CompilationRequest request = compilationQueue.first;
printTrace('Compiling ${request.path}');
- final Stopwatch compilerTime = new Stopwatch()..start();
+ final Stopwatch compilerTime = Stopwatch()..start();
bool firstCompile = false;
if (compiler == null) {
compiler = createCompiler();
@@ -298,13 +298,13 @@
}
final StreamController<_CompilationRequest> compilerController =
- new StreamController<_CompilationRequest>();
+ StreamController<_CompilationRequest>();
final List<_CompilationRequest> compilationQueue = <_CompilationRequest>[];
ResidentCompiler compiler;
Future<String> compile(String mainDart) {
- final Completer<String> completer = new Completer<String>();
- compilerController.add(new _CompilationRequest(mainDart, completer));
+ final Completer<String> completer = Completer<String>();
+ compilerController.add(_CompilationRequest(mainDart, completer));
return handleTimeout<String>(completer.future, mainDart);
}
@@ -385,18 +385,18 @@
}
final int ourTestCount = _testCount;
_testCount += 1;
- final StreamController<dynamic> localController = new StreamController<dynamic>();
- final StreamController<dynamic> remoteController = new StreamController<dynamic>();
- final Completer<_AsyncError> testCompleteCompleter = new Completer<_AsyncError>();
- final _FlutterPlatformStreamSinkWrapper<dynamic> remoteSink = new _FlutterPlatformStreamSinkWrapper<dynamic>(
+ final StreamController<dynamic> localController = StreamController<dynamic>();
+ final StreamController<dynamic> remoteController = StreamController<dynamic>();
+ final Completer<_AsyncError> testCompleteCompleter = Completer<_AsyncError>();
+ final _FlutterPlatformStreamSinkWrapper<dynamic> remoteSink = _FlutterPlatformStreamSinkWrapper<dynamic>(
remoteController.sink,
testCompleteCompleter.future,
);
- final StreamChannel<dynamic> localChannel = new StreamChannel<dynamic>.withGuarantees(
+ final StreamChannel<dynamic> localChannel = StreamChannel<dynamic>.withGuarantees(
remoteController.stream,
localController.sink,
);
- final StreamChannel<dynamic> remoteChannel = new StreamChannel<dynamic>.withGuarantees(
+ final StreamChannel<dynamic> remoteChannel = StreamChannel<dynamic>.withGuarantees(
localController.stream,
remoteSink,
);
@@ -426,7 +426,7 @@
printTrace('test $ourTestCount: shutting down test harness socket server');
await server.close(force: true);
});
- final Completer<WebSocket> webSocket = new Completer<WebSocket>();
+ final Completer<WebSocket> webSocket = Completer<WebSocket>();
server.listen(
(HttpRequest request) {
if (!webSocket.isCompleted)
@@ -460,7 +460,7 @@
if (precompiledDillPath == null && precompiledDillFiles == null) {
// Lazily instantiate compiler so it is built only if it is actually used.
- compiler ??= new _Compiler(trackWidgetCreation, projectRootDirectory);
+ compiler ??= _Compiler(trackWidgetCreation, projectRootDirectory);
mainDart = await compiler.compile(mainDart);
if (mainDart == null) {
@@ -495,8 +495,8 @@
}
});
- final Completer<void> timeout = new Completer<void>();
- final Completer<void> gotProcessObservatoryUri = new Completer<void>();
+ final Completer<void> timeout = Completer<void>();
+ final Completer<void> gotProcessObservatoryUri = Completer<void>();
if (!enableObservatory)
gotProcessObservatoryUri.complete();
@@ -519,10 +519,10 @@
}
processObservatoryUri = detectedUri;
gotProcessObservatoryUri.complete();
- watcher?.handleStartedProcess(new ProcessEvent(ourTestCount, process, processObservatoryUri));
+ watcher?.handleStartedProcess(ProcessEvent(ourTestCount, process, processObservatoryUri));
},
startTimeoutTimer: () {
- new Future<_InitialResult>.delayed(_kTestStartupTimeout).then((_) => timeout.complete());
+ Future<_InitialResult>.delayed(_kTestStartupTimeout).then((_) => timeout.complete());
},
);
@@ -535,7 +535,7 @@
final _InitialResult initialResult = await Future.any(<Future<_InitialResult>>[
process.exitCode.then<_InitialResult>((int exitCode) => _InitialResult.crashed),
timeout.future.then<_InitialResult>((void value) => _InitialResult.timedOut),
- new Future<_InitialResult>.delayed(_kTestProcessTimeout, () => _InitialResult.timedOut),
+ Future<_InitialResult>.delayed(_kTestProcessTimeout, () => _InitialResult.timedOut),
gotProcessObservatoryUri.future.then<_InitialResult>((void value) {
return webSocket.future.then<_InitialResult>(
(WebSocket webSocket) => _InitialResult.connected,
@@ -554,7 +554,7 @@
controller.sink.close(); // ignore: unawaited_futures
printTrace('test $ourTestCount: waiting for controller sink to close');
await controller.sink.done;
- await watcher?.handleTestCrashed(new ProcessEvent(ourTestCount, process));
+ await watcher?.handleTestCrashed(ProcessEvent(ourTestCount, process));
break;
case _InitialResult.timedOut:
// Could happen either if the process takes a long time starting
@@ -567,13 +567,13 @@
controller.sink.close(); // ignore: unawaited_futures
printTrace('test $ourTestCount: waiting for controller sink to close');
await controller.sink.done;
- await watcher?.handleTestTimedOut(new ProcessEvent(ourTestCount, process));
+ await watcher?.handleTestTimedOut(ProcessEvent(ourTestCount, process));
break;
case _InitialResult.connected:
printTrace('test $ourTestCount: process with pid ${process.pid} connected to test harness');
final WebSocket testSocket = await webSocket.future;
- final Completer<void> harnessDone = new Completer<void>();
+ final Completer<void> harnessDone = Completer<void>();
final StreamSubscription<dynamic> harnessToTest = controller.stream.listen(
(dynamic event) { testSocket.add(json.encode(event)); },
onDone: harnessDone.complete,
@@ -590,7 +590,7 @@
cancelOnError: true,
);
- final Completer<void> testDone = new Completer<void>();
+ final Completer<void> testDone = Completer<void>();
final StreamSubscription<dynamic> testToHarness = testSocket.listen(
(dynamic encodedEvent) {
assert(encodedEvent is String); // we shouldn't ever get binary messages
@@ -642,7 +642,7 @@
assert(testResult == _TestResult.testBailed);
printTrace('test $ourTestCount: process with pid ${process.pid} no longer needs test harness');
}
- await watcher?.handleFinishedTest(new ProcessEvent(ourTestCount, process, processObservatoryUri));
+ await watcher?.handleFinishedTest(ProcessEvent(ourTestCount, process, processObservatoryUri));
break;
}
break;
@@ -653,7 +653,7 @@
controller.sink.addError(error, stack);
} else {
printError('unhandled error during test:\n$testPath\n$error\n$stack');
- outOfBandError ??= new _AsyncError(error, stack);
+ outOfBandError ??= _AsyncError(error, stack);
}
} finally {
printTrace('test $ourTestCount: cleaning up...');
@@ -667,7 +667,7 @@
controller.sink.addError(error, stack);
} else {
printError('unhandled error during finalization of test:\n$testPath\n$error\n$stack');
- outOfBandError ??= new _AsyncError(error, stack);
+ outOfBandError ??= _AsyncError(error, stack);
}
}
}
@@ -787,7 +787,7 @@
if (_cachedFontConfig != null)
return _cachedFontConfig;
- final StringBuffer sb = new StringBuffer();
+ final StringBuffer sb = StringBuffer();
sb.writeln('<fontconfig>');
sb.writeln(' <dir>${cache.getCacheArtifacts().path}</dir>');
sb.writeln(' <cachedir>/var/cache/fontconfig</cachedir>');
@@ -942,7 +942,7 @@
@override
Future<void> get done => _done.future;
- final Completer<void> _done = new Completer<void>();
+ final Completer<void> _done = Completer<void>();
@override
Future<dynamic> close() {
diff --git a/packages/flutter_tools/lib/src/tester/flutter_tester.dart b/packages/flutter_tools/lib/src/tester/flutter_tester.dart
index adf2905..2487d63 100644
--- a/packages/flutter_tools/lib/src/tester/flutter_tester.dart
+++ b/packages/flutter_tools/lib/src/tester/flutter_tester.dart
@@ -25,7 +25,7 @@
final Directory _directory;
factory FlutterTesterApp.fromCurrentDirectory() {
- return new FlutterTesterApp._(fs.currentDirectory);
+ return FlutterTesterApp._(fs.currentDirectory);
}
FlutterTesterApp._(Directory directory)
@@ -44,7 +44,7 @@
FlutterTesterDevice(String deviceId) : super(deviceId);
Process _process;
- final DevicePortForwarder _portForwarder = new _NoopPortForwarder();
+ final DevicePortForwarder _portForwarder = _NoopPortForwarder();
@override
Future<bool> get isLocalEmulator async => false;
@@ -68,7 +68,7 @@
void clearLogs() {}
final _FlutterTesterDeviceLogReader _logReader =
- new _FlutterTesterDeviceLogReader();
+ _FlutterTesterDeviceLogReader();
@override
DeviceLogReader getLogReader({ApplicationPackage app}) => _logReader;
@@ -104,7 +104,7 @@
if (!buildInfo.isDebug) {
printError('This device only supports debug mode.');
- return new LaunchResult.failed();
+ return LaunchResult.failed();
}
final String shellPath = artifacts.getArtifactPath(Artifact.flutterTester);
@@ -168,18 +168,18 @@
});
if (!debuggingOptions.debuggingEnabled)
- return new LaunchResult.succeeded();
+ return LaunchResult.succeeded();
- final ProtocolDiscovery observatoryDiscovery = new ProtocolDiscovery.observatory(
+ final ProtocolDiscovery observatoryDiscovery = ProtocolDiscovery.observatory(
getLogReader(),
hostPort: debuggingOptions.observatoryPort,
);
final Uri observatoryUri = await observatoryDiscovery.uri;
- return new LaunchResult.succeeded(observatoryUri: observatoryUri);
+ return LaunchResult.succeeded(observatoryUri: observatoryUri);
} catch (error) {
printError('Failed to launch $package: $error');
- return new LaunchResult.failed();
+ return LaunchResult.failed();
}
}
@@ -202,7 +202,7 @@
static bool showFlutterTesterDevice = false;
final FlutterTesterDevice _testerDevice =
- new FlutterTesterDevice(kTesterDeviceId);
+ FlutterTesterDevice(kTesterDeviceId);
@override
bool get canListAnything => true;
@@ -218,7 +218,7 @@
class _FlutterTesterDeviceLogReader extends DeviceLogReader {
final StreamController<String> _logLinesController =
- new StreamController<String>.broadcast();
+ StreamController<String>.broadcast();
@override
int get appPid => 0;
@@ -239,7 +239,7 @@
Future<int> forward(int devicePort, {int hostPort}) {
if (hostPort != null && hostPort != devicePort)
throw 'Forwarding to a different port is not supported by flutter tester';
- return new Future<int>.value(devicePort);
+ return Future<int>.value(devicePort);
}
@override
diff --git a/packages/flutter_tools/lib/src/tracing.dart b/packages/flutter_tools/lib/src/tracing.dart
index 132cf0a..0a72a48 100644
--- a/packages/flutter_tools/lib/src/tracing.dart
+++ b/packages/flutter_tools/lib/src/tracing.dart
@@ -20,7 +20,7 @@
static Future<Tracing> connect(Uri uri) async {
final VMService observatory = await VMService.connect(uri);
- return new Tracing(observatory);
+ return Tracing(observatory);
}
final VMService vmService;
@@ -41,7 +41,7 @@
await vmService.vm.setVMTimelineFlags(<String>[]);
timeline = await vmService.vm.getVMTimeline();
} else {
- final Completer<Null> whenFirstFrameRendered = new Completer<Null>();
+ final Completer<Null> whenFirstFrameRendered = Completer<Null>();
(await vmService.onTimelineEvent).listen((ServiceEvent timelineEvent) {
final List<Map<String, dynamic>> events = timelineEvent.timelineEvents;
@@ -86,7 +86,7 @@
if (!(await traceInfoFile.parent.exists()))
await traceInfoFile.parent.create();
- final Tracing tracing = new Tracing(observatory);
+ final Tracing tracing = Tracing(observatory);
final Map<String, dynamic> timeline = await tracing.stopTracingAndDownloadTimeline(
waitForFirstFrame: true
@@ -94,7 +94,7 @@
int extractInstantEventTimestamp(String eventName) {
final List<Map<String, dynamic>> events =
- new List<Map<String, dynamic>>.from(timeline['traceEvents']);
+ List<Map<String, dynamic>>.from(timeline['traceEvents']);
final Map<String, dynamic> event = events.firstWhere(
(Map<String, dynamic> event) => event['name'] == eventName, orElse: () => null
);
diff --git a/packages/flutter_tools/lib/src/usage.dart b/packages/flutter_tools/lib/src/usage.dart
index 06b2d4b..a49553d 100644
--- a/packages/flutter_tools/lib/src/usage.dart
+++ b/packages/flutter_tools/lib/src/usage.dart
@@ -25,7 +25,7 @@
Usage({ String settingsName = 'flutter', String versionOverride, String configDirOverride}) {
final FlutterVersion flutterVersion = FlutterVersion.instance;
final String version = versionOverride ?? flutterVersion.getVersionString(redactUnknownBranches: true);
- _analytics = new AnalyticsIO(_kFlutterUA, settingsName, version,
+ _analytics = AnalyticsIO(_kFlutterUA, settingsName, version,
// Analyzer doesn't recognize that [Directory] objects match up due to a
// conditional import.
// ignore: argument_type_not_assignable
diff --git a/packages/flutter_tools/lib/src/version.dart b/packages/flutter_tools/lib/src/version.dart
index 728d446..e1dea0e 100644
--- a/packages/flutter_tools/lib/src/version.dart
+++ b/packages/flutter_tools/lib/src/version.dart
@@ -43,7 +43,7 @@
String _repositoryUrl;
String get repositoryUrl => _repositoryUrl;
- static Set<String> officialChannels = new Set<String>.from(<String>[
+ static Set<String> officialChannels = Set<String>.from(<String>[
'master',
'dev',
'beta',
@@ -292,7 +292,7 @@
stamp.store(
newTimeWarningWasPrinted: _clock.now(),
),
- new Future<Null>.delayed(timeToPauseToLetUserReadTheMessage),
+ Future<Null>.delayed(timeToPauseToLetUserReadTheMessage),
]);
}
}
@@ -411,7 +411,7 @@
: null;
}
- return new VersionCheckStamp(
+ return VersionCheckStamp(
lastTimeVersionWasChecked: readDateTime('lastTimeVersionWasChecked'),
lastKnownRemoteVersion: readDateTime('lastKnownRemoteVersion'),
lastTimeWarningWasPrinted: readDateTime('lastTimeWarningWasPrinted'),
@@ -488,7 +488,7 @@
return results.stdout.trim();
if (!lenient) {
- throw new VersionCheckError(
+ throw VersionCheckError(
'Command exited with code ${results.exitCode}: ${command.join(' ')}\n'
'Standard error: ${results.stderr}'
);
@@ -511,7 +511,7 @@
if (results.exitCode == 0)
return results.stdout.trim();
- throw new VersionCheckError(
+ throw VersionCheckError(
'Command exited with code ${results.exitCode}: ${command.join(' ')}\n'
'Standard error: ${results.stderr}'
);
@@ -544,14 +544,14 @@
static GitTagVersion determine() {
final String version = _runGit('git describe --match v*.*.* --first-parent --long --tags');
- final RegExp versionPattern = new RegExp('^v([0-9]+)\.([0-9]+)\.([0-9]+)-([0-9]+)-g([a-f0-9]+)\$');
+ final RegExp versionPattern = RegExp('^v([0-9]+)\.([0-9]+)\.([0-9]+)-([0-9]+)-g([a-f0-9]+)\$');
final List<String> parts = versionPattern.matchAsPrefix(version)?.groups(<int>[1, 2, 3, 4, 5]);
if (parts == null) {
printTrace('Could not interpret results of "git describe": $version');
return const GitTagVersion.unknown();
}
final List<int> parsedParts = parts.take(4).map<int>(int.tryParse).toList();
- return new GitTagVersion(parsedParts[0], parsedParts[1], parsedParts[2], parsedParts[3], parts[4]);
+ return GitTagVersion(parsedParts[0], parsedParts[1], parsedParts[2], parsedParts[3], parts[4]);
}
String frameworkVersionFor(String revision) {
diff --git a/packages/flutter_tools/lib/src/vmservice.dart b/packages/flutter_tools/lib/src/vmservice.dart
index 51bc7fa..a99c278 100644
--- a/packages/flutter_tools/lib/src/vmservice.dart
+++ b/packages/flutter_tools/lib/src/vmservice.dart
@@ -66,7 +66,7 @@
printTrace('This was attempt #$attempts. Will retry in $delay.');
// Delay next attempt.
- await new Future<Null>.delayed(delay);
+ await Future<Null>.delayed(delay);
// Back off exponentially.
delay *= 2;
@@ -84,13 +84,13 @@
}
if (socket == null) {
- throw new ToolExit(
+ throw ToolExit(
'Attempted to connect to Dart observatory $_kMaxAttempts times, and '
'all attempts failed. Giving up. The URL was $uri'
);
}
- return new IOWebSocketChannel(socket).cast<String>();
+ return IOWebSocketChannel(socket).cast<String>();
}
/// The default VM service request timeout.
@@ -112,7 +112,7 @@
ReloadSources reloadSources,
CompileExpression compileExpression,
) {
- _vm = new VM._empty(this);
+ _vm = VM._empty(this);
_peer.listen().catchError(_connectionError.completeError);
_peer.registerMethod('streamNotify', (rpc.Parameters event) {
@@ -126,11 +126,11 @@
final bool pause = params.asMap['pause'] ?? false;
if (isolateId is! String || isolateId.isEmpty)
- throw new rpc.RpcException.invalidParams('Invalid \'isolateId\': $isolateId');
+ throw rpc.RpcException.invalidParams('Invalid \'isolateId\': $isolateId');
if (force is! bool)
- throw new rpc.RpcException.invalidParams('Invalid \'force\': $force');
+ throw rpc.RpcException.invalidParams('Invalid \'force\': $force');
if (pause is! bool)
- throw new rpc.RpcException.invalidParams('Invalid \'pause\': $pause');
+ throw rpc.RpcException.invalidParams('Invalid \'pause\': $pause');
try {
await reloadSources(isolateId, force: force, pause: pause);
@@ -138,7 +138,7 @@
} on rpc.RpcException {
rethrow;
} catch (e, st) {
- throw new rpc.RpcException(rpc_error_code.SERVER_ERROR,
+ throw rpc.RpcException(rpc_error_code.SERVER_ERROR,
'Error during Sources Reload: $e\n$st');
}
});
@@ -155,16 +155,16 @@
_peer.registerMethod('compileExpression', (rpc.Parameters params) async {
final String isolateId = params['isolateId'].asString;
if (isolateId is! String || isolateId.isEmpty)
- throw new rpc.RpcException.invalidParams(
+ throw rpc.RpcException.invalidParams(
'Invalid \'isolateId\': $isolateId');
final String expression = params['expression'].asString;
if (expression is! String || expression.isEmpty)
- throw new rpc.RpcException.invalidParams(
+ throw rpc.RpcException.invalidParams(
'Invalid \'expression\': $expression');
final List<String> definitions =
- new List<String>.from(params['definitions'].asList);
+ List<String>.from(params['definitions'].asList);
final List<String> typeDefinitions =
- new List<String>.from(params['typeDefinitions'].asList);
+ List<String>.from(params['typeDefinitions'].asList);
final String libraryUri = params['libraryUri'].asString;
final String klass = params['klass'].exists ? params['klass'].asString : null;
final bool isStatic = params['isStatic'].asBoolOr(false);
@@ -178,7 +178,7 @@
} on rpc.RpcException {
rethrow;
} catch (e, st) {
- throw new rpc.RpcException(rpc_error_code.SERVER_ERROR,
+ throw rpc.RpcException(rpc_error_code.SERVER_ERROR,
'Error during expression compilation: $e\n$st');
}
});
@@ -201,7 +201,7 @@
final Directory dir = getRecordingSink(location, _kRecordingType);
_openChannel = (Uri uri) async {
final StreamChannel<String> delegate = await _defaultOpenChannel(uri);
- return new RecordingVMServiceChannel(delegate, dir);
+ return RecordingVMServiceChannel(delegate, dir);
};
}
@@ -212,7 +212,7 @@
/// passed to [enableRecordingConnection]), or a [ToolExit] will be thrown.
static void enableReplayConnection(String location) {
final Directory dir = getReplaySource(location, _kRecordingType);
- _openChannel = (Uri uri) async => new ReplayVMServiceChannel(dir);
+ _openChannel = (Uri uri) async => ReplayVMServiceChannel(dir);
}
/// Connect to a Dart VM Service at [httpUri].
@@ -234,8 +234,8 @@
}) async {
final Uri wsUri = httpUri.replace(scheme: 'ws', path: fs.path.join(httpUri.path, 'ws'));
final StreamChannel<String> channel = await _openChannel(wsUri);
- final rpc.Peer peer = new rpc.Peer.withoutJson(jsonDocument.bind(channel));
- final VMService service = new VMService._(peer, httpUri, wsUri, requestTimeout, reloadSources, compileExpression);
+ final rpc.Peer peer = rpc.Peer.withoutJson(jsonDocument.bind(channel));
+ final VMService service = VMService._(peer, httpUri, wsUri, requestTimeout, reloadSources, compileExpression);
// This call is to ensure we are able to establish a connection instead of
// keeping on trucking and failing farther down the process.
await service._sendRequest('getVersion', const <String, dynamic>{});
@@ -246,7 +246,7 @@
final Uri wsAddress;
final rpc.Peer _peer;
final Duration _requestTimeout;
- final Completer<Map<String, dynamic>> _connectionError = new Completer<Map<String, dynamic>>();
+ final Completer<Map<String, dynamic>> _connectionError = Completer<Map<String, dynamic>>();
VM _vm;
/// The singleton [VM] object. Owns [Isolate] and [FlutterView] objects.
@@ -255,7 +255,7 @@
final Map<String, StreamController<ServiceEvent>> _eventControllers =
<String, StreamController<ServiceEvent>>{};
- final Set<String> _listeningFor = new Set<String>();
+ final Set<String> _listeningFor = Set<String>();
/// Whether our connection to the VM service has been closed;
bool get isClosed => _peer.isClosed;
@@ -298,7 +298,7 @@
StreamController<ServiceEvent> _getEventController(String eventName) {
StreamController<ServiceEvent> controller = _eventControllers[eventName];
if (controller == null) {
- controller = new StreamController<ServiceEvent>.broadcast();
+ controller = StreamController<ServiceEvent>.broadcast();
_eventControllers[eventName] = controller;
}
return controller;
@@ -316,7 +316,7 @@
if (eventIsolate != null) {
// getFromMap creates the Isolate if necessary.
final Isolate isolate = vm.getFromMap(eventIsolate);
- event = new ServiceObject._fromMap(isolate, eventData);
+ event = ServiceObject._fromMap(isolate, eventData);
if (event.kind == ServiceEvent.kIsolateExit) {
vm._isolateCache.remove(isolate.id);
vm._buildIsolateList();
@@ -327,7 +327,7 @@
}
} else {
// The event doesn't have an isolate, so it is owned by the VM.
- event = new ServiceObject._fromMap(vm, eventData);
+ event = ServiceObject._fromMap(vm, eventData);
}
_getEventController(streamId).add(event);
}
@@ -351,7 +351,7 @@
for (int i = 0; (vm.firstView == null) && (i < attempts); i++) {
// If the VM doesn't yet have a view, wait for one to show up.
printTrace('Waiting for Flutter view');
- await new Future<Null>.delayed(new Duration(seconds: attemptSeconds));
+ await Future<Null>.delayed(Duration(seconds: attemptSeconds));
await getVM();
await vm.refreshViews();
}
@@ -425,25 +425,25 @@
return null;
if (!_isServiceMap(map))
- throw new VMServiceObjectLoadError('Expected a service map', map);
+ throw VMServiceObjectLoadError('Expected a service map', map);
final String type = _stripRef(map['type']);
ServiceObject serviceObject;
switch (type) {
case 'Event':
- serviceObject = new ServiceEvent._empty(owner);
+ serviceObject = ServiceEvent._empty(owner);
break;
case 'FlutterView':
- serviceObject = new FlutterView._empty(owner.vm);
+ serviceObject = FlutterView._empty(owner.vm);
break;
case 'Isolate':
- serviceObject = new Isolate._empty(owner.vm);
+ serviceObject = Isolate._empty(owner.vm);
break;
}
// If we don't have a model object for this service object type, as a
// fallback return a ServiceMap object.
- serviceObject ??= new ServiceMap._empty(owner);
+ serviceObject ??= ServiceMap._empty(owner);
// We have now constructed an empty service object, call update to populate it.
serviceObject.updateFromMap(map);
return serviceObject;
@@ -511,14 +511,14 @@
}
if (_inProgressReload == null) {
- final Completer<ServiceObject> completer = new Completer<ServiceObject>();
+ final Completer<ServiceObject> completer = Completer<ServiceObject>();
_inProgressReload = completer.future;
try {
final Map<String, dynamic> response = await _fetchDirect();
if (_stripRef(response['type']) == 'Sentinel') {
// An object may have been collected.
- completer.complete(new ServiceObject._fromMap(owner, response));
+ completer.complete(ServiceObject._fromMap(owner, response));
} else {
updateFromMap(response);
completer.complete(this);
@@ -540,7 +540,7 @@
final String mapType = _stripRef(map['type']);
if ((_type != null) && (_type != mapType)) {
- throw new VMServiceObjectLoadError('ServiceObject types must not change',
+ throw VMServiceObjectLoadError('ServiceObject types must not change',
map);
}
_type = mapType;
@@ -548,7 +548,7 @@
_canCache = map['fixedId'] == true;
if ((_id != null) && (_id != map['id']) && _canCache) {
- throw new VMServiceObjectLoadError('ServiceObject id changed', map);
+ throw VMServiceObjectLoadError('ServiceObject id changed', map);
}
_id = map['id'];
@@ -614,7 +614,7 @@
_kind = map['kind'];
assert(map['isolate'] == null || owner == map['isolate']);
_timestamp =
- new DateTime.fromMillisecondsSinceEpoch(map['timestamp']);
+ DateTime.fromMillisecondsSinceEpoch(map['timestamp']);
if (map['extensionKind'] != null) {
_extensionKind = map['extensionKind'];
_extensionData = map['extensionData'];
@@ -747,7 +747,7 @@
void _removeDeadIsolates(List<Isolate> newIsolates) {
// Build a set of new isolates.
- final Set<String> newIsolateSet = new Set<String>();
+ final Set<String> newIsolateSet = Set<String>();
for (Isolate iso in newIsolates)
newIsolateSet.add(iso.id);
@@ -782,7 +782,7 @@
Isolate isolate = _isolateCache[mapId];
if (isolate == null) {
// Add new isolate to the cache.
- isolate = new ServiceObject._fromMap(this, map);
+ isolate = ServiceObject._fromMap(this, map);
_isolateCache[mapId] = isolate;
_buildIsolateList();
@@ -801,7 +801,7 @@
FlutterView view = _viewCache[mapId];
if (view == null) {
// Add new view to the cache.
- view = new ServiceObject._fromMap(this, map);
+ view = ServiceObject._fromMap(this, map);
_viewCache[mapId] = view;
} else {
view.updateFromMap(map);
@@ -810,7 +810,7 @@
}
break;
default:
- throw new VMServiceObjectLoadError(
+ throw VMServiceObjectLoadError(
'VM.getFromMap called for something other than an isolate', map);
}
}
@@ -821,7 +821,7 @@
// Trigger a VM load, then get the isolate. Ignore any errors.
return load().then<Isolate>((ServiceObject serviceObject) => getIsolate(isolateId)).catchError((dynamic error) => null);
}
- return new Future<Isolate>.value(_isolateCache[isolateId]);
+ return Future<Isolate>.value(_isolateCache[isolateId]);
}
/// Invoke the RPC and return the raw response.
@@ -845,7 +845,7 @@
} on TimeoutException {
printTrace('Request to Dart VM Service timed out: $method($params)');
if (timeoutFatal)
- throw new TimeoutException('Request to Dart VM Service timed out: $method($params)');
+ throw TimeoutException('Request to Dart VM Service timed out: $method($params)');
return null;
} on WebSocketChannelException catch (error) {
throwToolExit('Error connecting to observatory: $error');
@@ -867,7 +867,7 @@
params: params,
timeout: timeout,
);
- final ServiceObject serviceObject = new ServiceObject._fromMap(this, response);
+ final ServiceObject serviceObject = ServiceObject._fromMap(this, response);
if ((serviceObject != null) && (serviceObject._canCache)) {
final String serviceObjectId = serviceObject.id;
_cache.putIfAbsent(serviceObjectId, () => serviceObject);
@@ -1000,13 +1000,13 @@
final double mcs = _totalCollectionTimeInSeconds *
Duration.microsecondsPerSecond /
math.max(_collections, 1);
- return new Duration(microseconds: mcs.ceil());
+ return Duration(microseconds: mcs.ceil());
}
Duration get avgCollectionPeriod {
final double mcs = _averageCollectionPeriodInMillis *
Duration.microsecondsPerMillisecond;
- return new Duration(microseconds: mcs.ceil());
+ return Duration(microseconds: mcs.ceil());
}
@override
@@ -1083,7 +1083,7 @@
return serviceObject;
}
// Build the object from the map directly.
- serviceObject = new ServiceObject._fromMap(this, map);
+ serviceObject = ServiceObject._fromMap(this, map);
if ((serviceObject != null) && serviceObject.canCache)
_cache[mapId] = serviceObject;
return serviceObject;
@@ -1117,9 +1117,9 @@
}
void _updateHeaps(Map<String, dynamic> map, bool mapIsRef) {
- _newSpace ??= new HeapSpace._empty(this);
+ _newSpace ??= HeapSpace._empty(this);
_newSpace._update(map['new'], mapIsRef);
- _oldSpace ??= new HeapSpace._empty(this);
+ _oldSpace ??= HeapSpace._empty(this);
_oldSpace._update(map['old'], mapIsRef);
}
@@ -1130,7 +1130,7 @@
_loaded = true;
final int startTimeMillis = map['startTime'];
- startTime = new DateTime.fromMillisecondsSinceEpoch(startTimeMillis);
+ startTime = DateTime.fromMillisecondsSinceEpoch(startTimeMillis);
_upgradeCollection(map, this);
@@ -1158,7 +1158,7 @@
final Map<String, dynamic> response = await invokeRpcRaw('_reloadSources', params: arguments);
return response;
} on rpc.RpcException catch (e) {
- return new Future<Map<String, dynamic>>.error(<String, dynamic>{
+ return Future<Map<String, dynamic>>.error(<String, dynamic>{
'code': e.code,
'message': e.message,
'data': e.data,
@@ -1199,11 +1199,11 @@
for (int i = 1; i < lineTuple.length; i += 2) {
if (lineTuple[i] == tokenPos) {
final int column = lineTuple[i + 1];
- return new ProgramElement(name, uri, line, column);
+ return ProgramElement(name, uri, line, column);
}
}
}
- return new ProgramElement(name, uri);
+ return ProgramElement(name, uri);
}
// Lists program elements changed in the most recent reload that have not
@@ -1425,7 +1425,7 @@
Uri assetsDirectoryUri) async {
final String viewId = id;
// When this completer completes the isolate is running.
- final Completer<Null> completer = new Completer<Null>();
+ final Completer<Null> completer = Completer<Null>();
final StreamSubscription<ServiceEvent> subscription =
(await owner.vm.vmService.onIsolateEvent).listen((ServiceEvent event) {
// TODO(johnmccutchan): Listen to the debug stream and catch initial
diff --git a/packages/flutter_tools/lib/src/vmservice_record_replay.dart b/packages/flutter_tools/lib/src/vmservice_record_replay.dart
index cce1442..49dd7c3 100644
--- a/packages/flutter_tools/lib/src/vmservice_record_replay.dart
+++ b/packages/flutter_tools/lib/src/vmservice_record_replay.dart
@@ -43,12 +43,12 @@
@override
Stream<String> get stream {
- _streamRecorder ??= new _RecordingStream(super.stream, _messages);
+ _streamRecorder ??= _RecordingStream(super.stream, _messages);
return _streamRecorder.stream;
}
@override
- StreamSink<String> get sink => _sinkRecorder ??= new _RecordingSink(super.sink, _messages);
+ StreamSink<String> get sink => _sinkRecorder ??= _RecordingSink(super.sink, _messages);
}
/// Base class for request and response JSON-rpc messages.
@@ -60,8 +60,8 @@
factory _Message.fromRecording(Map<String, dynamic> recordingData) {
return recordingData[_kType] == _kRequest
- ? new _Request(recordingData[_kData])
- : new _Response(recordingData[_kData]);
+ ? _Request(recordingData[_kData])
+ : _Response(recordingData[_kData]);
}
int get id => data[_kId];
@@ -123,8 +123,8 @@
_RecordingStream(Stream<String> stream, this._recording)
: _delegate = stream,
_controller = stream.isBroadcast
- ? new StreamController<String>.broadcast()
- : new StreamController<String>() {
+ ? StreamController<String>.broadcast()
+ : StreamController<String>() {
_controller.onListen = () {
assert(_subscription == null);
_subscription = _listenToStream();
@@ -147,7 +147,7 @@
StreamSubscription<String> _listenToStream() {
return _delegate.listen(
(String element) {
- _recording.add(new _Response.fromString(element));
+ _recording.add(_Response.fromString(element));
_controller.add(element);
},
onError: _controller.addError, // We currently don't support recording of errors.
@@ -176,17 +176,17 @@
@override
void add(String data) {
_delegate.add(data);
- _recording.add(new _Request.fromString(data));
+ _recording.add(_Request.fromString(data));
}
@override
void addError(dynamic errorEvent, [StackTrace stackTrace]) {
- throw new UnimplementedError('Add support for this if the need ever arises');
+ throw UnimplementedError('Add support for this if the need ever arises');
}
@override
Future<dynamic> addStream(Stream<String> stream) {
- throw new UnimplementedError('Add support for this if the need ever arises');
+ throw UnimplementedError('Add support for this if the need ever arises');
}
}
@@ -195,7 +195,7 @@
/// replays the corresponding responses back from the recording.
class ReplayVMServiceChannel extends StreamChannelMixin<String> {
final Map<int, _Transaction> _transactions;
- final StreamController<String> _controller = new StreamController<String>();
+ final StreamController<String> _controller = StreamController<String>();
_ReplaySink _replaySink;
ReplayVMServiceChannel(Directory location)
@@ -208,7 +208,7 @@
final Map<int, _Transaction> transactions = <int, _Transaction>{};
for (_Message message in messages) {
final _Transaction transaction =
- transactions.putIfAbsent(message.id, () => new _Transaction());
+ transactions.putIfAbsent(message.id, () => _Transaction());
if (message.type == _kRequest) {
assert(transaction.request == null);
transaction.request = message;
@@ -221,12 +221,12 @@
}
static _Message _toMessage(Map<String, dynamic> jsonData) {
- return new _Message.fromRecording(jsonData);
+ return _Message.fromRecording(jsonData);
}
void send(_Request request) {
if (!_transactions.containsKey(request.id))
- throw new ArgumentError('No matching invocation found');
+ throw ArgumentError('No matching invocation found');
final _Transaction transaction = _transactions.remove(request.id);
// TODO(tvolkert): validate that `transaction.request` matches `request`
if (transaction.response == null) {
@@ -243,7 +243,7 @@
}
@override
- StreamSink<String> get sink => _replaySink ??= new _ReplaySink(this);
+ StreamSink<String> get sink => _replaySink ??= _ReplaySink(this);
@override
Stream<String> get stream => _controller.stream;
@@ -251,7 +251,7 @@
class _ReplaySink implements StreamSink<String> {
final ReplayVMServiceChannel channel;
- final Completer<Null> _completer = new Completer<Null>();
+ final Completer<Null> _completer = Completer<Null>();
_ReplaySink(this.channel);
@@ -267,18 +267,18 @@
@override
void add(String data) {
if (_completer.isCompleted)
- throw new StateError('Sink already closed');
- channel.send(new _Request.fromString(data));
+ throw StateError('Sink already closed');
+ channel.send(_Request.fromString(data));
}
@override
void addError(dynamic errorEvent, [StackTrace stackTrace]) {
- throw new UnimplementedError('Add support for this if the need ever arises');
+ throw UnimplementedError('Add support for this if the need ever arises');
}
@override
Future<dynamic> addStream(Stream<String> stream) {
- throw new UnimplementedError('Add support for this if the need ever arises');
+ throw UnimplementedError('Add support for this if the need ever arises');
}
}
diff --git a/packages/flutter_tools/lib/src/vscode/vscode.dart b/packages/flutter_tools/lib/src/vscode/vscode.dart
index ddbd086..3ea9a3f 100644
--- a/packages/flutter_tools/lib/src/vscode/vscode.dart
+++ b/packages/flutter_tools/lib/src/vscode/vscode.dart
@@ -39,7 +39,7 @@
final FileSystemEntity extensionDir = extensionDirs.first;
_isValid = true;
- _extensionVersion = new Version.parse(
+ _extensionVersion = Version.parse(
extensionDir.basename.substring('$extensionIdentifier-'.length));
_validationMessages.add('Flutter extension version $_extensionVersion');
}
@@ -63,8 +63,8 @@
final String versionString = _getVersionFromPackageJson(packageJsonPath);
Version version;
if (versionString != null)
- version = new Version.parse(versionString);
- return new VsCode._(installPath, extensionDirectory, version: version, edition: edition);
+ version = Version.parse(versionString);
+ return VsCode._(installPath, extensionDirectory, version: version, edition: edition);
}
bool get isValid => _isValid;
@@ -94,20 +94,20 @@
// $HOME/.vscode-insiders/extensions
static List<VsCode> _installedMacOS() {
return _findInstalled(<_VsCodeInstallLocation>[
- new _VsCodeInstallLocation(
+ _VsCodeInstallLocation(
fs.path.join('/Applications', 'Visual Studio Code.app', 'Contents'),
'.vscode',
),
- new _VsCodeInstallLocation(
+ _VsCodeInstallLocation(
fs.path.join(homeDirPath, 'Applications', 'Visual Studio Code.app', 'Contents'),
'.vscode',
),
- new _VsCodeInstallLocation(
+ _VsCodeInstallLocation(
fs.path.join('/Applications', 'Visual Studio Code - Insiders.app', 'Contents'),
'.vscode-insiders',
isInsiders: true,
),
- new _VsCodeInstallLocation(
+ _VsCodeInstallLocation(
fs.path.join(homeDirPath, 'Applications', 'Visual Studio Code - Insiders.app', 'Contents'),
'.vscode-insiders',
isInsiders: true,
@@ -133,16 +133,16 @@
final String localAppData = platform.environment['localappdata'];
return _findInstalled(<_VsCodeInstallLocation>[
- new _VsCodeInstallLocation(fs.path.join(localAppData, 'Programs\\Microsoft VS Code'), '.vscode'),
- new _VsCodeInstallLocation(fs.path.join(progFiles86, 'Microsoft VS Code'), '.vscode',
+ _VsCodeInstallLocation(fs.path.join(localAppData, 'Programs\\Microsoft VS Code'), '.vscode'),
+ _VsCodeInstallLocation(fs.path.join(progFiles86, 'Microsoft VS Code'), '.vscode',
edition: '32-bit edition'),
- new _VsCodeInstallLocation(fs.path.join(progFiles, 'Microsoft VS Code'), '.vscode',
+ _VsCodeInstallLocation(fs.path.join(progFiles, 'Microsoft VS Code'), '.vscode',
edition: '64-bit edition'),
- new _VsCodeInstallLocation(fs.path.join(localAppData, 'Programs\\Microsoft VS Code Insiders'), '.vscode-insiders',
+ _VsCodeInstallLocation(fs.path.join(localAppData, 'Programs\\Microsoft VS Code Insiders'), '.vscode-insiders',
isInsiders: true),
- new _VsCodeInstallLocation(fs.path.join(progFiles86 , 'Microsoft VS Code Insiders'), '.vscode-insiders',
+ _VsCodeInstallLocation(fs.path.join(progFiles86 , 'Microsoft VS Code Insiders'), '.vscode-insiders',
edition: '32-bit edition', isInsiders: true),
- new _VsCodeInstallLocation(fs.path.join(progFiles, 'Microsoft VS Code Insiders'), '.vscode-insiders',
+ _VsCodeInstallLocation(fs.path.join(progFiles, 'Microsoft VS Code Insiders'), '.vscode-insiders',
edition: '64-bit edition', isInsiders: true),
]);
}
@@ -173,7 +173,7 @@
if (fs.isDirectorySync(searchLocation.installPath)) {
final String extensionDirectory =
fs.path.join(homeDirPath, searchLocation.extensionsFolder, 'extensions');
- results.add(new VsCode.fromDirectory(searchLocation.installPath, extensionDirectory, edition: searchLocation.edition));
+ results.add(VsCode.fromDirectory(searchLocation.installPath, extensionDirectory, edition: searchLocation.edition));
}
}
diff --git a/packages/flutter_tools/lib/src/vscode/vscode_validator.dart b/packages/flutter_tools/lib/src/vscode/vscode_validator.dart
index 0bfe602..115f50f 100644
--- a/packages/flutter_tools/lib/src/vscode/vscode_validator.dart
+++ b/packages/flutter_tools/lib/src/vscode/vscode_validator.dart
@@ -18,7 +18,7 @@
static Iterable<DoctorValidator> get installedValidators {
return VsCode
.allInstalled()
- .map((VsCode vsCode) => new VsCodeValidator(vsCode));
+ .map((VsCode vsCode) => VsCodeValidator(vsCode));
}
@override
@@ -28,19 +28,19 @@
final String vsCodeVersionText = _vsCode.version == Version.unknown
? null
: 'version ${_vsCode.version}';
- messages.add(new ValidationMessage('VS Code at ${_vsCode.directory}'));
+ messages.add(ValidationMessage('VS Code at ${_vsCode.directory}'));
if (_vsCode.isValid) {
type = ValidationType.installed;
messages.addAll(_vsCode.validationMessages
- .map((String m) => new ValidationMessage(m)));
+ .map((String m) => ValidationMessage(m)));
} else {
type = ValidationType.partial;
messages.addAll(_vsCode.validationMessages
- .map((String m) => new ValidationMessage.error(m)));
- messages.add(new ValidationMessage(
+ .map((String m) => ValidationMessage.error(m)));
+ messages.add(ValidationMessage(
'Flutter extension not installed; install from\n$extensionMarketplaceUrl'));
}
- return new ValidationResult(type, messages, statusInfo: vsCodeVersionText);
+ return ValidationResult(type, messages, statusInfo: vsCodeVersionText);
}
}