Unnecessary new (#20138)
* enable lint unnecessary_new
* fix tests
* fix tests
* fix tests
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;