enable lint prefer_single_quotes (#12665)
This commit is contained in:
committed by
GitHub
parent
b07ea41954
commit
1fce14a31c
@@ -26,9 +26,9 @@ import '../lib/src/usage.dart';
|
||||
|
||||
// Note: this was largely inspired by lib/src/commands/test.dart.
|
||||
|
||||
const String _kOptionPackages = "packages";
|
||||
const String _kOptionShell = "shell";
|
||||
const String _kOptionTestDirectory = "test-directory";
|
||||
const String _kOptionPackages = 'packages';
|
||||
const String _kOptionShell = 'shell';
|
||||
const String _kOptionTestDirectory = 'test-directory';
|
||||
const List<String> _kRequiredOptions = const <String>[
|
||||
_kOptionPackages,
|
||||
_kOptionShell,
|
||||
|
||||
@@ -175,7 +175,7 @@ Future<int> _handleToolError(
|
||||
writelnStderr();
|
||||
writelnStderr(
|
||||
"Run 'flutter -h' (or 'flutter <command> -h') for available "
|
||||
"flutter commands and options."
|
||||
'flutter commands and options.'
|
||||
);
|
||||
// Argument error exit code.
|
||||
return _exit(64);
|
||||
|
||||
@@ -772,7 +772,7 @@ class _AndroidDevicePortForwarder extends DevicePortForwarder {
|
||||
final List<String> lines = LineSplitter.split(stdout).toList();
|
||||
for (String line in lines) {
|
||||
if (line.startsWith(device.id)) {
|
||||
final List<String> splitLine = line.split("tcp:");
|
||||
final List<String> splitLine = line.split('tcp:');
|
||||
|
||||
// Sanity check splitLine.
|
||||
if (splitLine.length != 3)
|
||||
|
||||
@@ -43,7 +43,7 @@ FlutterPluginVersion get flutterPluginVersion {
|
||||
final File plugin = fs.file('android/buildSrc/src/main/groovy/FlutterPlugin.groovy');
|
||||
if (plugin.existsSync()) {
|
||||
final String packageLine = plugin.readAsLinesSync().skip(4).first;
|
||||
if (packageLine == "package io.flutter.gradle") {
|
||||
if (packageLine == 'package io.flutter.gradle') {
|
||||
return FlutterPluginVersion.v2;
|
||||
}
|
||||
return FlutterPluginVersion.v1;
|
||||
@@ -51,7 +51,7 @@ FlutterPluginVersion get flutterPluginVersion {
|
||||
final File appGradle = fs.file('android/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(new RegExp(r'apply from: .*/flutter.gradle'))) {
|
||||
return FlutterPluginVersion.managed;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ class AndroidApk extends ApplicationPackage {
|
||||
if (category.getAttribute('android:name') == 'android.intent.category.LAUNCHER') {
|
||||
final xml.XmlElement activity = category.parent.parent;
|
||||
final String activityName = activity.getAttribute('android:name');
|
||||
launchActivity = "$packageId/$activityName";
|
||||
launchActivity = '$packageId/$activityName';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,5 +40,5 @@ class ToolExit implements Exception {
|
||||
final int exitCode;
|
||||
|
||||
@override
|
||||
String toString() => "Exception: $message";
|
||||
String toString() => 'Exception: $message';
|
||||
}
|
||||
|
||||
@@ -118,13 +118,13 @@ class _PosixUtils extends OperatingSystemUtils {
|
||||
if (_name == null) {
|
||||
if (platform.isMacOS) {
|
||||
final List<ProcessResult> results = <ProcessResult>[
|
||||
processManager.runSync(<String>["sw_vers", "-productName"]),
|
||||
processManager.runSync(<String>["sw_vers", "-productVersion"]),
|
||||
processManager.runSync(<String>["sw_vers", "-buildVersion"]),
|
||||
processManager.runSync(<String>['sw_vers', '-productName']),
|
||||
processManager.runSync(<String>['sw_vers', '-productVersion']),
|
||||
processManager.runSync(<String>['sw_vers', '-buildVersion']),
|
||||
];
|
||||
if (results.every((ProcessResult result) => result.exitCode == 0)) {
|
||||
_name = "${results[0].stdout.trim()} ${results[1].stdout
|
||||
.trim()} ${results[2].stdout.trim()}";
|
||||
_name = '${results[0].stdout.trim()} ${results[1].stdout
|
||||
.trim()} ${results[2].stdout.trim()}';
|
||||
}
|
||||
}
|
||||
_name ??= super.name;
|
||||
|
||||
@@ -298,7 +298,7 @@ void _traceCommand(List<String> args, { String workingDirectory }) {
|
||||
if (workingDirectory == null)
|
||||
printTrace(argsText);
|
||||
else
|
||||
printTrace("[$workingDirectory${fs.path.separator}] $argsText");
|
||||
printTrace('[$workingDirectory${fs.path.separator}] $argsText');
|
||||
}
|
||||
|
||||
String _runWithLoggingSync(List<String> cmd, {
|
||||
|
||||
@@ -239,10 +239,10 @@ Future<String> _buildAotSnapshot(
|
||||
];
|
||||
|
||||
if ((extraFrontEndOptions != null) && extraFrontEndOptions.isNotEmpty)
|
||||
printTrace("Extra front-end options: $extraFrontEndOptions");
|
||||
printTrace('Extra front-end options: $extraFrontEndOptions');
|
||||
|
||||
if ((extraGenSnapshotOptions != null) && extraGenSnapshotOptions.isNotEmpty) {
|
||||
printTrace("Extra gen-snapshot options: $extraGenSnapshotOptions");
|
||||
printTrace('Extra gen-snapshot options: $extraGenSnapshotOptions');
|
||||
genSnapshotCmd.addAll(extraGenSnapshotOptions);
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ class CreateCommand extends FlutterCommand {
|
||||
'If run on a project that already exists, this will repair the project, recreating any files that are missing.';
|
||||
|
||||
@override
|
||||
String get invocation => "${runner.executableName} $name <output directory>";
|
||||
String get invocation => '${runner.executableName} $name <output directory>';
|
||||
|
||||
@override
|
||||
Future<Null> runCommand() async {
|
||||
@@ -249,17 +249,17 @@ To edit platform code in an IDE see https://flutter.io/platform-plugins/#edit-co
|
||||
}
|
||||
} else {
|
||||
printStatus("You'll need to install additional components before you can run "
|
||||
"your Flutter app:");
|
||||
'your Flutter app:');
|
||||
printStatus('');
|
||||
|
||||
// Give the user more detailed analysis.
|
||||
await doctor.diagnose();
|
||||
printStatus('');
|
||||
printStatus("After installing components, run 'flutter doctor' in order to "
|
||||
"re-validate your setup.");
|
||||
're-validate your setup.');
|
||||
printStatus("When complete, type 'flutter run' from the '$relativeAppPath' "
|
||||
"directory in order to launch your app.");
|
||||
printStatus("Your main program file is: $relativeAppPath/lib/main.dart");
|
||||
'directory in order to launch your app.');
|
||||
printStatus('Your main program file is: $relativeAppPath/lib/main.dart');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -290,7 +290,7 @@ To edit platform code in an IDE see https://flutter.io/platform-plugins/#edit-co
|
||||
'dartSdk': '$flutterRoot/bin/cache/dart-sdk',
|
||||
'androidMinApiLevel': android.minApiLevel,
|
||||
'androidSdkVersion': android_sdk.minimumAndroidSdkVersion,
|
||||
'androidFlutterJar': "$flutterRoot/bin/cache/artifacts/engine/android-arm/flutter.jar",
|
||||
'androidFlutterJar': '$flutterRoot/bin/cache/artifacts/engine/android-arm/flutter.jar',
|
||||
'withDriverTest': renderDriverTest,
|
||||
'pluginClass': pluginClass,
|
||||
'pluginDartClass': pluginDartClass,
|
||||
@@ -333,7 +333,7 @@ String _createPluginClassName(String name) {
|
||||
|
||||
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 = new RegExp(r'[^a-zA-Z0-9\-\.\u0080-\uffff]+');
|
||||
name = camelCase(name).replaceAll(disallowed, '');
|
||||
name = name.isEmpty ? 'untitled' : name;
|
||||
return '$organization.$name';
|
||||
@@ -367,7 +367,7 @@ String _validateProjectName(String projectName) {
|
||||
|
||||
if (_packageDependencies.contains(projectName)) {
|
||||
return "Invalid project name: '$projectName' - this will conflict with Flutter "
|
||||
"package dependencies.";
|
||||
'package dependencies.';
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -376,7 +376,7 @@ String _validateProjectName(String projectName) {
|
||||
/// if we should disallow the directory name.
|
||||
String _validateProjectDir(String dirPath, { String flutterRoot }) {
|
||||
if (fs.path.isWithin(flutterRoot, dirPath)) {
|
||||
return "Cannot create a project within the Flutter SDK.\n"
|
||||
return 'Cannot create a project within the Flutter SDK.\n'
|
||||
"Target directory '$dirPath' is within the Flutter SDK at '$flutterRoot'.";
|
||||
}
|
||||
|
||||
|
||||
@@ -197,28 +197,28 @@ abstract class Domain {
|
||||
|
||||
String _getStringArg(Map<String, dynamic> args, String name, { bool required: false }) {
|
||||
if (required && !args.containsKey(name))
|
||||
throw "$name is required";
|
||||
throw '$name is required';
|
||||
final dynamic val = args[name];
|
||||
if (val != null && val is! String)
|
||||
throw "$name is not a String";
|
||||
throw '$name is not a String';
|
||||
return val;
|
||||
}
|
||||
|
||||
bool _getBoolArg(Map<String, dynamic> args, String name, { bool required: false }) {
|
||||
if (required && !args.containsKey(name))
|
||||
throw "$name is required";
|
||||
throw '$name is required';
|
||||
final dynamic val = args[name];
|
||||
if (val != null && val is! bool)
|
||||
throw "$name is not a bool";
|
||||
throw '$name is not a bool';
|
||||
return val;
|
||||
}
|
||||
|
||||
int _getIntArg(Map<String, dynamic> args, String name, { bool required: false }) {
|
||||
if (required && !args.containsKey(name))
|
||||
throw "$name is required";
|
||||
throw '$name is required';
|
||||
final dynamic val = args[name];
|
||||
if (val != null && val is! int)
|
||||
throw "$name is not an int";
|
||||
throw '$name is not an int';
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ class DevicesCommand extends FlutterCommand {
|
||||
if (!doctor.canListAnything) {
|
||||
throwToolExit(
|
||||
"Unable to locate a development device; please run 'flutter doctor' for "
|
||||
"information about installing additional components.",
|
||||
'information about installing additional components.',
|
||||
exitCode: 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ class FormatCommand extends FlutterCommand {
|
||||
final String description = 'Format one or more dart files.';
|
||||
|
||||
@override
|
||||
String get invocation => "${runner.executableName} $name <one or more paths>";
|
||||
String get invocation => '${runner.executableName} $name <one or more paths>';
|
||||
|
||||
@override
|
||||
Future<Null> runCommand() async {
|
||||
|
||||
@@ -256,9 +256,9 @@ class FuchsiaReloadCommand extends FlutterCommand {
|
||||
|
||||
// The Observatory requires somewhat non-standard URIs that the Uri class
|
||||
// can't build for us, so instead we build them by hand.
|
||||
final String isolateIdQuery = "?isolateId=isolates%2F$number";
|
||||
final String isolateAddr = "$vmServiceAddr/#/inspect$isolateIdQuery";
|
||||
final String debuggerAddr = "$vmServiceAddr/#/debugger$isolateIdQuery";
|
||||
final String isolateIdQuery = '?isolateId=isolates%2F$number';
|
||||
final String isolateAddr = '$vmServiceAddr/#/inspect$isolateIdQuery';
|
||||
final String debuggerAddr = '$vmServiceAddr/#/debugger$isolateIdQuery';
|
||||
|
||||
final String newUsed = getSizeAsMB(isolate.newSpace.used);
|
||||
final String newCap = getSizeAsMB(isolate.newSpace.capacity);
|
||||
@@ -452,7 +452,7 @@ class _PortForwarder {
|
||||
final ProcessResult result = await processManager.run(command);
|
||||
printTrace(command.join(' '));
|
||||
if (result.exitCode != 0) {
|
||||
printTrace("Command failed:\nstdout: ${result.stdout}\nstderr: ${result.stderr}");
|
||||
printTrace('Command failed:\nstdout: ${result.stdout}\nstderr: ${result.stderr}');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -487,7 +487,7 @@ class FuchsiaDeviceCommandRunner {
|
||||
printTrace(args.join(' '));
|
||||
final ProcessResult result = await processManager.run(args);
|
||||
if (result.exitCode != 0) {
|
||||
printStatus("Command failed: $command\nstdout: ${result.stdout}\nstderr: ${result.stderr}");
|
||||
printStatus('Command failed: $command\nstdout: ${result.stdout}\nstderr: ${result.stderr}');
|
||||
return null;
|
||||
}
|
||||
printTrace(result.stdout);
|
||||
|
||||
@@ -498,10 +498,10 @@ class DevFS {
|
||||
try {
|
||||
await _httpWriter.write(dirtyEntries);
|
||||
} on SocketException catch (socketException, stackTrace) {
|
||||
printTrace("DevFS sync failed. Lost connection to device: $socketException");
|
||||
printTrace('DevFS sync failed. Lost connection to device: $socketException');
|
||||
throw new DevFSException('Lost connection to device.', socketException, stackTrace);
|
||||
} catch (exception, stackTrace) {
|
||||
printError("Could not update files on device: $exception");
|
||||
printError('Could not update files on device: $exception');
|
||||
throw new DevFSException('Sync failed', exception, stackTrace);
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -191,7 +191,7 @@ abstract class Device {
|
||||
|
||||
// String meant to be displayed to the user indicating if the device is
|
||||
// supported by Flutter, and, if not, why.
|
||||
String supportMessage() => isSupported() ? "Supported" : "Unsupported";
|
||||
String supportMessage() => isSupported() ? 'Supported' : 'Unsupported';
|
||||
|
||||
/// The device's platform.
|
||||
Future<TargetPlatform> get targetPlatform;
|
||||
|
||||
@@ -286,7 +286,7 @@ Future<XcodeBuildResult> buildXcodeProject({
|
||||
commands.addAll(<String>[
|
||||
'-workspace', fs.path.basename(entity.path),
|
||||
'-scheme', scheme,
|
||||
"BUILD_DIR=${fs.path.absolute(getIosBuildDirectory())}",
|
||||
'BUILD_DIR=${fs.path.absolute(getIosBuildDirectory())}',
|
||||
]);
|
||||
break;
|
||||
}
|
||||
@@ -447,20 +447,20 @@ bool _checkXcodeVersion() {
|
||||
|
||||
Future<Null> _addServicesToBundle(Directory bundle) async {
|
||||
final List<Map<String, String>> services = <Map<String, String>>[];
|
||||
printTrace("Trying to resolve native pub services.");
|
||||
printTrace('Trying to resolve native pub services.');
|
||||
|
||||
// Step 1: Parse the service configuration yaml files present in the service
|
||||
// pub packages.
|
||||
await parseServiceConfigs(services);
|
||||
printTrace("Found ${services.length} service definition(s).");
|
||||
printTrace('Found ${services.length} service definition(s).');
|
||||
|
||||
// Step 2: Copy framework dylibs to the correct spot for xcodebuild to pick up.
|
||||
final Directory frameworksDirectory = fs.directory(fs.path.join(bundle.path, "Frameworks"));
|
||||
final Directory frameworksDirectory = fs.directory(fs.path.join(bundle.path, 'Frameworks'));
|
||||
await _copyServiceFrameworks(services, frameworksDirectory);
|
||||
|
||||
// Step 3: Copy the service definitions manifest at the correct spot for
|
||||
// xcodebuild to pick up.
|
||||
final File manifestFile = fs.file(fs.path.join(bundle.path, "ServiceDefinitions.json"));
|
||||
final File manifestFile = fs.file(fs.path.join(bundle.path, 'ServiceDefinitions.json'));
|
||||
_copyServiceDefinitionsManifest(services, manifestFile);
|
||||
}
|
||||
|
||||
@@ -470,7 +470,7 @@ Future<Null> _copyServiceFrameworks(List<Map<String, String>> services, Director
|
||||
for (Map<String, String> service in services) {
|
||||
final String dylibPath = await getServiceFromUrl(service['ios-framework'], service['root'], service['name']);
|
||||
final File dylib = fs.file(dylibPath);
|
||||
printTrace("Copying ${dylib.path} into bundle.");
|
||||
printTrace('Copying ${dylib.path} into bundle.');
|
||||
if (!dylib.existsSync()) {
|
||||
printError("The service dylib '${dylib.path}' does not exist.");
|
||||
continue;
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
import '../base/file_system.dart';
|
||||
import '../base/process.dart';
|
||||
|
||||
const String kCFBundleIdentifierKey = "CFBundleIdentifier";
|
||||
const String kCFBundleShortVersionStringKey = "CFBundleShortVersionString";
|
||||
const String kCFBundleIdentifierKey = 'CFBundleIdentifier';
|
||||
const String kCFBundleShortVersionStringKey = 'CFBundleShortVersionString';
|
||||
|
||||
String getValueFromFile(String plistFilePath, String key) {
|
||||
// TODO(chinmaygarde): For now, we only need to read from plist files on a mac
|
||||
|
||||
@@ -433,7 +433,7 @@ class HotRunner extends ResidentRunner {
|
||||
timer.stop();
|
||||
status.cancel();
|
||||
if (result.isOk)
|
||||
printStatus("${result.message} in ${getElapsedAsMilliseconds(timer.elapsed)}.");
|
||||
printStatus('${result.message} in ${getElapsedAsMilliseconds(timer.elapsed)}.');
|
||||
if (result.hint != null)
|
||||
printStatus(result.hint);
|
||||
return result;
|
||||
@@ -530,7 +530,7 @@ class HotRunner extends ResidentRunner {
|
||||
reloadMessage = 'Reloaded $loadedLibraryCount of $finalLibraryCount libraries';
|
||||
}
|
||||
} catch (error, st) {
|
||||
printError("Hot reload failed: $error\n$st");
|
||||
printError('Hot reload failed: $error\n$st');
|
||||
final int errorCode = error['code'];
|
||||
final String errorMessage = error['message'];
|
||||
if (errorCode == Isolate.kIsolateReloadBarred) {
|
||||
@@ -587,8 +587,8 @@ class HotRunner extends ResidentRunner {
|
||||
await view.uiIsolate.flutterReassemble();
|
||||
} on TimeoutException {
|
||||
reassembleTimedOut = true;
|
||||
printTrace("Reassembling ${view.uiIsolate.name} took too long.");
|
||||
printStatus("Hot reloading ${view.uiIsolate.name} took too long; the reload may have failed.");
|
||||
printTrace('Reassembling ${view.uiIsolate.name} took too long.');
|
||||
printStatus('Hot reloading ${view.uiIsolate.name} took too long; the reload may have failed.');
|
||||
continue;
|
||||
} catch (error) {
|
||||
reassembleAndScheduleErrors = true;
|
||||
|
||||
@@ -265,18 +265,18 @@ abstract class FlutterCommand extends Command<Null> {
|
||||
Future<List<Device>> findAllTargetDevices() async {
|
||||
if (!doctor.canLaunchAnything) {
|
||||
printError("Unable to locate a development device; please run 'flutter doctor' "
|
||||
"for information about installing additional components.");
|
||||
'for information about installing additional components.');
|
||||
return null;
|
||||
}
|
||||
|
||||
List<Device> devices = await deviceManager.getDevices().toList();
|
||||
|
||||
if (devices.isEmpty && deviceManager.hasSpecifiedDeviceId) {
|
||||
printStatus("No devices found with name or id "
|
||||
printStatus('No devices found with name or id '
|
||||
"matching '${deviceManager.specifiedDeviceId}'");
|
||||
return null;
|
||||
} else if (devices.isEmpty && deviceManager.hasSpecifiedAllDevices) {
|
||||
printStatus("No devices found");
|
||||
printStatus('No devices found');
|
||||
return null;
|
||||
} else if (devices.isEmpty) {
|
||||
printNoConnectedDevices();
|
||||
@@ -290,10 +290,10 @@ abstract class FlutterCommand extends Command<Null> {
|
||||
return null;
|
||||
} else if (devices.length > 1 && !deviceManager.hasSpecifiedAllDevices) {
|
||||
if (deviceManager.hasSpecifiedDeviceId) {
|
||||
printStatus("Found ${devices.length} devices with name or id matching "
|
||||
printStatus('Found ${devices.length} devices with name or id matching '
|
||||
"'${deviceManager.specifiedDeviceId}':");
|
||||
} else {
|
||||
printStatus("More than one device connected; please specify a device with "
|
||||
printStatus('More than one device connected; please specify a device with '
|
||||
"the '-d <deviceId>' flag, or use '-d all' to act on all devices.");
|
||||
devices = await deviceManager.getAllConnectedDevices().toList();
|
||||
}
|
||||
@@ -313,7 +313,7 @@ abstract class FlutterCommand extends Command<Null> {
|
||||
if (deviceList == null)
|
||||
return null;
|
||||
if (deviceList.length > 1) {
|
||||
printStatus("More than one device connected; please specify a device with "
|
||||
printStatus('More than one device connected; please specify a device with '
|
||||
"the '-d <deviceId>' flag.");
|
||||
deviceList = await deviceManager.getAllConnectedDevices().toList();
|
||||
printStatus('');
|
||||
|
||||
@@ -75,10 +75,10 @@ Future<Null> parseServiceConfigs(
|
||||
}
|
||||
|
||||
Future<String> getServiceFromUrl(String url, String rootDir, String serviceName) async {
|
||||
if (url.startsWith("android-sdk:") && androidSdk != null) {
|
||||
if (url.startsWith('android-sdk:') && androidSdk != null) {
|
||||
// It's something shipped in the standard android SDK.
|
||||
return url.replaceAll('android-sdk:', '${androidSdk.directory}/');
|
||||
} else if (url.startsWith("http")) {
|
||||
} else if (url.startsWith('http')) {
|
||||
// It's a regular file to download.
|
||||
return await cache.getThirdPartyFile(url, serviceName);
|
||||
} else {
|
||||
|
||||
@@ -10,7 +10,7 @@ import 'globals.dart';
|
||||
|
||||
const String _kTemplateExtension = '.tmpl';
|
||||
const String _kCopyTemplateExtension = '.copy.tmpl';
|
||||
final Pattern _kTemplateLanguageVariant = new RegExp(r"(\w+)-(\w+)\.tmpl.*");
|
||||
final Pattern _kTemplateLanguageVariant = new RegExp(r'(\w+)-(\w+)\.tmpl.*');
|
||||
|
||||
/// Expands templates in a directory to a destination. All files that must
|
||||
/// undergo template expansion should end with the '.tmpl' extension. All other
|
||||
|
||||
@@ -15,8 +15,8 @@ class EventPrinter extends TestWatcher {
|
||||
|
||||
@override
|
||||
void onStartedProcess(ProcessEvent event) {
|
||||
_sendEvent("test.startedProcess",
|
||||
<String, dynamic>{"observatoryUri": event.observatoryUri.toString()});
|
||||
_sendEvent('test.startedProcess',
|
||||
<String, dynamic>{'observatoryUri': event.observatoryUri.toString()});
|
||||
}
|
||||
|
||||
void _sendEvent(String name, [dynamic params]) {
|
||||
|
||||
@@ -408,8 +408,8 @@ class _FlutterPlatform extends PlatformPlugin {
|
||||
|
||||
String _getWebSocketUrl(HttpServer server) {
|
||||
return host.type == InternetAddressType.IP_V4
|
||||
? "ws://${host.address}:${server.port}"
|
||||
: "ws://[${host.address}]:${server.port}";
|
||||
? 'ws://${host.address}:${server.port}'
|
||||
: 'ws://[${host.address}]:${server.port}';
|
||||
}
|
||||
|
||||
String _generateTestMain({
|
||||
|
||||
@@ -44,11 +44,11 @@ Future<int> runTests(
|
||||
}
|
||||
|
||||
for (String name in names) {
|
||||
testArgs..add("--name")..add(name);
|
||||
testArgs..add('--name')..add(name);
|
||||
}
|
||||
|
||||
for (String plainName in plainNames) {
|
||||
testArgs..add("--plain-name")..add(plainName);
|
||||
testArgs..add('--plain-name')..add(plainName);
|
||||
}
|
||||
|
||||
testArgs.add('--');
|
||||
|
||||
@@ -321,7 +321,7 @@ abstract class ServiceObject {
|
||||
return null;
|
||||
|
||||
if (!_isServiceMap(map))
|
||||
throw new VMServiceObjectLoadError("Expected a service map", map);
|
||||
throw new VMServiceObjectLoadError('Expected a service map', map);
|
||||
|
||||
final String type = _stripRef(map['type']);
|
||||
|
||||
@@ -435,7 +435,7 @@ abstract class ServiceObject {
|
||||
final String mapType = _stripRef(map['type']);
|
||||
|
||||
if ((_type != null) && (_type != mapType)) {
|
||||
throw new VMServiceObjectLoadError("ServiceObject types must not change",
|
||||
throw new VMServiceObjectLoadError('ServiceObject types must not change',
|
||||
map);
|
||||
}
|
||||
_type = mapType;
|
||||
@@ -443,7 +443,7 @@ abstract class ServiceObject {
|
||||
|
||||
_canCache = map['fixedId'] == true;
|
||||
if ((_id != null) && (_id != map['id']) && _canCache) {
|
||||
throw new VMServiceObjectLoadError("ServiceObject id changed", map);
|
||||
throw new VMServiceObjectLoadError('ServiceObject id changed', map);
|
||||
}
|
||||
_id = map['id'];
|
||||
|
||||
@@ -1061,7 +1061,7 @@ class Isolate extends ServiceObjectOwner {
|
||||
if (ownerType == 'Library' || ownerType == '@Library')
|
||||
break;
|
||||
final String ownerName = owner['name'];
|
||||
name = "$ownerName.$name";
|
||||
name = '$ownerName.$name';
|
||||
owner = owner['owner'];
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ $fontsSection
|
||||
}
|
||||
|
||||
void writePackagesFile(String packages) {
|
||||
fs.file(".packages")
|
||||
fs.file('.packages')
|
||||
..createSync()
|
||||
..writeAsStringSync(packages);
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ $assetsSection
|
||||
}
|
||||
|
||||
void writePackagesFile(String packages) {
|
||||
fs.file(".packages")
|
||||
fs.file('.packages')
|
||||
..createSync()
|
||||
..writeAsStringSync(packages);
|
||||
}
|
||||
@@ -155,7 +155,7 @@ $assetsSection
|
||||
expectedAssetManifest,
|
||||
);
|
||||
}, overrides: contextOverrides);
|
||||
|
||||
|
||||
testUsingContext("One asset is bundled when the package has one asset, listed in the app's pubspec", () async {
|
||||
establishFlutterRoot();
|
||||
|
||||
@@ -180,7 +180,7 @@ $assetsSection
|
||||
);
|
||||
}, overrides: contextOverrides);
|
||||
|
||||
testUsingContext("One asset and its variant are bundled when the package has an asset and a variant, and lists the asset in its pubspec", () async {
|
||||
testUsingContext('One asset and its variant are bundled when the package has an asset and a variant, and lists the asset in its pubspec', () async {
|
||||
establishFlutterRoot();
|
||||
|
||||
writePubspecFile('pubspec.yaml', 'test');
|
||||
@@ -204,7 +204,7 @@ $assetsSection
|
||||
);
|
||||
}, overrides: contextOverrides);
|
||||
|
||||
testUsingContext("One asset and its variant are bundled when the package has an asset and a variant, and the app lists the asset in its pubspec", () async {
|
||||
testUsingContext('One asset and its variant are bundled when the package has an asset and a variant, and the app lists the asset in its pubspec', () async {
|
||||
establishFlutterRoot();
|
||||
|
||||
writePubspecFile(
|
||||
@@ -231,7 +231,7 @@ $assetsSection
|
||||
);
|
||||
}, overrides: contextOverrides);
|
||||
|
||||
testUsingContext("Two assets are bundled when the package has and lists two assets in its pubspec", () async {
|
||||
testUsingContext('Two assets are bundled when the package has and lists two assets in its pubspec', () async {
|
||||
establishFlutterRoot();
|
||||
|
||||
writePubspecFile('pubspec.yaml', 'test');
|
||||
@@ -288,7 +288,7 @@ $assetsSection
|
||||
);
|
||||
}, overrides: contextOverrides);
|
||||
|
||||
testUsingContext("Two assets are bundled when two packages each have and list an asset their pubspec", () async {
|
||||
testUsingContext('Two assets are bundled when two packages each have and list an asset their pubspec', () async {
|
||||
establishFlutterRoot();
|
||||
|
||||
writePubspecFile(
|
||||
@@ -323,7 +323,7 @@ $assetsSection
|
||||
expectedAssetManifest,
|
||||
);
|
||||
}, overrides: contextOverrides);
|
||||
|
||||
|
||||
testUsingContext("Two assets are bundled when two packages each have an asset, listed in the app's pubspec", () async {
|
||||
establishFlutterRoot();
|
||||
|
||||
@@ -363,7 +363,7 @@ $assetsSection
|
||||
);
|
||||
}, overrides: contextOverrides);
|
||||
|
||||
testUsingContext("One asset is bundled when the app depends on a package, listing in its pubspec an asset from another package", () async {
|
||||
testUsingContext('One asset is bundled when the app depends on a package, listing in its pubspec an asset from another package', () async {
|
||||
establishFlutterRoot();
|
||||
writePubspecFile(
|
||||
'pubspec.yaml',
|
||||
|
||||
@@ -23,7 +23,7 @@ void main() {
|
||||
// path separator.
|
||||
Cache.flutterRoot = getFlutterRoot();
|
||||
|
||||
fs.file("pubspec.yaml")
|
||||
fs.file('pubspec.yaml')
|
||||
..createSync()
|
||||
..writeAsStringSync(
|
||||
'''
|
||||
@@ -36,7 +36,7 @@ flutter:
|
||||
- a/b/c/foo
|
||||
'''
|
||||
);
|
||||
fs.file(".packages")..createSync();
|
||||
fs.file('.packages')..createSync();
|
||||
|
||||
final List<String> assets = <String>[
|
||||
'a/b/c/foo',
|
||||
|
||||
@@ -261,7 +261,7 @@ void main() {
|
||||
Cache.flutterRoot = '../..';
|
||||
final CreateCommand command = new CreateCommand();
|
||||
final CommandRunner<Null> runner = createTestCommandRunner(command);
|
||||
final File existingFile = fs.file("${projectDir.path.toString()}/bad");
|
||||
final File existingFile = fs.file('${projectDir.path.toString()}/bad');
|
||||
if (!existingFile.existsSync())
|
||||
existingFile.createSync(recursive: true);
|
||||
expect(
|
||||
|
||||
@@ -277,12 +277,12 @@ class MemoryIOSink implements IOSink {
|
||||
}
|
||||
|
||||
@override
|
||||
void writeln([Object obj = ""]) {
|
||||
void writeln([Object obj = '']) {
|
||||
add(encoding.encode('$obj\n'));
|
||||
}
|
||||
|
||||
@override
|
||||
void writeAll(Iterable<dynamic> objects, [String separator = ""]) {
|
||||
void writeAll(Iterable<dynamic> objects, [String separator = '']) {
|
||||
bool addSeparator = false;
|
||||
for (dynamic object in objects) {
|
||||
if (addSeparator) {
|
||||
|
||||
Reference in New Issue
Block a user