Add spaces after flow control statements (#126320)
This commit is contained in:
@@ -159,7 +159,7 @@ final GradleHandledError multidexErrorHandler = GradleHandledError(
|
||||
prompt: 'Do you want to continue with adding multidex support for Android?',
|
||||
defaultChoiceIndex: 0,
|
||||
);
|
||||
} on StateError catch(e) {
|
||||
} on StateError catch (e) {
|
||||
globals.printError(
|
||||
e.message,
|
||||
indent: 0,
|
||||
@@ -273,7 +273,7 @@ final GradleHandledError zipExceptionHandler = GradleHandledError(
|
||||
defaultChoiceIndex: 0,
|
||||
);
|
||||
shouldDeleteUserGradle = selection == 'y';
|
||||
} on StateError catch(e) {
|
||||
} on StateError catch (e) {
|
||||
globals.printError(
|
||||
e.message,
|
||||
indent: 0,
|
||||
|
||||
@@ -340,7 +340,7 @@ class _LinuxUtils extends _PosixUtils {
|
||||
for (String entry in osReleaseSplit) {
|
||||
entry = entry.trim();
|
||||
final List<String> entryKeyValuePair = entry.split('=');
|
||||
if(entryKeyValuePair[0] == key) {
|
||||
if (entryKeyValuePair[0] == key) {
|
||||
final String value = entryKeyValuePair[1];
|
||||
// Remove quotes from either end of the value if they exist
|
||||
final String quote = value[0];
|
||||
|
||||
@@ -260,7 +260,7 @@ class AssembleCommand extends FlutterCommand {
|
||||
|
||||
final Map<String, Object>? defineConfigJsonMap = extractDartDefineConfigJsonMap();
|
||||
final List<String> dartDefines = extractDartDefines(defineConfigJsonMap: defineConfigJsonMap);
|
||||
if(dartDefines.isNotEmpty){
|
||||
if (dartDefines.isNotEmpty){
|
||||
results[kDartDefines] = dartDefines.join(',');
|
||||
}
|
||||
|
||||
|
||||
@@ -342,7 +342,7 @@ class DriveCommand extends RunCommandBase {
|
||||
if (testResult != 0) {
|
||||
throwToolExit(null);
|
||||
}
|
||||
} on Exception catch(_) {
|
||||
} on Exception catch (_) {
|
||||
// On exceptions, including ToolExit, take a screenshot on the device
|
||||
// unless a screenshot was already taken on test failure.
|
||||
if (!screenshotTaken && screenshot != null) {
|
||||
|
||||
@@ -316,8 +316,8 @@ class PackagesGetCommand extends FlutterCommand {
|
||||
name,
|
||||
...subArgs,
|
||||
// `dart pub get` and friends defaults to `--no-example`.
|
||||
if(!exampleWasParsed && target != null) '--example',
|
||||
if(directoryOption == null && relativeTarget != null) ...<String>['--directory', relativeTarget],
|
||||
if (!exampleWasParsed && target != null) '--example',
|
||||
if (directoryOption == null && relativeTarget != null) ...<String>['--directory', relativeTarget],
|
||||
],
|
||||
project: rootProject,
|
||||
context: _context,
|
||||
|
||||
@@ -200,7 +200,7 @@ class DwarfSymbolizationService {
|
||||
.listen((String line) {
|
||||
try {
|
||||
output.writeln(line);
|
||||
} on Exception catch(e, s) {
|
||||
} on Exception catch (e, s) {
|
||||
subscription?.cancel().whenComplete(() {
|
||||
if (!onDone.isCompleted) {
|
||||
onDone.completeError(e, s);
|
||||
|
||||
@@ -99,7 +99,7 @@ class ValidateProject {
|
||||
|
||||
String getStringResult(ProjectValidatorResult result) {
|
||||
final String icon;
|
||||
switch(result.status) {
|
||||
switch (result.status) {
|
||||
case StatusProjectValidator.error:
|
||||
icon = '[✗]';
|
||||
case StatusProjectValidator.info:
|
||||
|
||||
@@ -348,7 +348,7 @@ class _DevFSHttpWriter implements DevFSWriter {
|
||||
DevFSContent content, {
|
||||
int retry = 0,
|
||||
}) async {
|
||||
while(true) {
|
||||
while (true) {
|
||||
try {
|
||||
final HttpClientRequest request = await _client.putUrl(httpAddress!);
|
||||
request.headers.removeAll(HttpHeaders.acceptEncodingHeader);
|
||||
|
||||
@@ -682,7 +682,7 @@ void _validateFonts(YamlList fonts, List<String> errors) {
|
||||
if (fontKey is! String) {
|
||||
errors.add('Expected "$fontKey" under "fonts" to be a string.');
|
||||
}
|
||||
switch(fontKey) {
|
||||
switch (fontKey) {
|
||||
case 'asset':
|
||||
if (kvp.value is! String) {
|
||||
errors.add('Expected font asset ${kvp.value} ((${kvp.value.runtimeType})) to be a string.');
|
||||
|
||||
@@ -329,7 +329,7 @@ public final class GeneratedPluginRegistrant {
|
||||
{{#supportsEmbeddingV2}}
|
||||
try {
|
||||
flutterEngine.getPlugins().add(new {{package}}.{{class}}());
|
||||
} catch(Exception e) {
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Error registering plugin {{name}}, {{package}}.{{class}}", e);
|
||||
}
|
||||
{{/supportsEmbeddingV2}}
|
||||
@@ -337,7 +337,7 @@ public final class GeneratedPluginRegistrant {
|
||||
{{#supportsEmbeddingV1}}
|
||||
try {
|
||||
{{package}}.{{class}}.registerWith(shimPluginRegistry.registrarFor("{{package}}.{{class}}"));
|
||||
} catch(Exception e) {
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Error registering plugin {{name}}, {{package}}.{{class}}", e);
|
||||
}
|
||||
{{/supportsEmbeddingV1}}
|
||||
|
||||
@@ -131,7 +131,7 @@ $indent])''';
|
||||
@override
|
||||
// ignore: avoid_equals_and_hash_code_on_mutable_classes, hash_and_equals
|
||||
bool operator==(covariant Node other) {
|
||||
if(value != other.value
|
||||
if (value != other.value
|
||||
|| type != other.type
|
||||
|| positionInMessage != other.positionInMessage
|
||||
|| children.length != other.children.length
|
||||
@@ -305,7 +305,7 @@ class Parser {
|
||||
} else {
|
||||
// Handle keywords separately. Otherwise, lexer will assume parts of identifiers may be keywords.
|
||||
final String tokenStr = match.group(0)!;
|
||||
switch(tokenStr) {
|
||||
switch (tokenStr) {
|
||||
case 'plural':
|
||||
matchedType = ST.plural;
|
||||
case 'select':
|
||||
@@ -351,7 +351,7 @@ class Parser {
|
||||
final ST symbol = parsingStack.removeLast();
|
||||
|
||||
// Figure out which production rule to use.
|
||||
switch(symbol) {
|
||||
switch (symbol) {
|
||||
case ST.message:
|
||||
if (tokens.isEmpty) {
|
||||
parseAndConstructNode(ST.message, 4);
|
||||
@@ -530,7 +530,7 @@ class Parser {
|
||||
// plural parts and select parts.
|
||||
void checkExtraRules(Node syntaxTree) {
|
||||
final List<Node> children = syntaxTree.children;
|
||||
switch(syntaxTree.type) {
|
||||
switch (syntaxTree.type) {
|
||||
case ST.pluralParts:
|
||||
// Must have an "other" case.
|
||||
if (children.every((Node node) => node.children[0].type != ST.other)) {
|
||||
|
||||
@@ -515,7 +515,7 @@ class AndroidProject extends FlutterProjectPlatform {
|
||||
}
|
||||
|
||||
File get appManifestFile {
|
||||
if(isUsingGradle) {
|
||||
if (isUsingGradle) {
|
||||
return hostAppGradleRoot
|
||||
.childDirectory('app')
|
||||
.childDirectory('src')
|
||||
|
||||
@@ -1450,7 +1450,7 @@ abstract class ResidentRunner extends ResidentHandlers {
|
||||
}
|
||||
try {
|
||||
await Future.wait(serveObservatoryRequests);
|
||||
} on vm_service.RPCError catch(e) {
|
||||
} on vm_service.RPCError catch (e) {
|
||||
globals.printWarning('Unable to enable Observatory: $e');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ enum WasmOptLevel implements CliEnum {
|
||||
String get cliName => name;
|
||||
|
||||
@override
|
||||
String get helpText => switch(this) {
|
||||
String get helpText => switch (this) {
|
||||
WasmOptLevel.none => 'wasm-opt is not run. Fastest build; bigger, slower output.',
|
||||
WasmOptLevel.debug => 'Similar to `${WasmOptLevel.full.name}`, but member names are preserved. Debugging is easier, but size is a bit bigger.',
|
||||
WasmOptLevel.full => 'wasm-opt is run. Build time is slower, but output is smaller and faster.',
|
||||
|
||||
@@ -208,7 +208,7 @@ void main() {
|
||||
try {
|
||||
localFileSystem.systemTempDirectory;
|
||||
fail('expected tool exit');
|
||||
} on ToolExit catch(e) {
|
||||
} on ToolExit catch (e) {
|
||||
expect(e.message, 'Your system temp directory (/does_not_exist) does not exist. '
|
||||
'Did you set an invalid override in your environment? '
|
||||
'See issue https://github.com/flutter/flutter/issues/74042 for more context.'
|
||||
|
||||
@@ -506,13 +506,13 @@ void main() {
|
||||
final MemoryIOSink frontendServerStdIn = MemoryIOSink();
|
||||
Stream<List<int>> frontendServerStdOut() async* {
|
||||
int processed = 0;
|
||||
while(true) {
|
||||
while(frontendServerStdIn.writes.length == processed) {
|
||||
while (true) {
|
||||
while (frontendServerStdIn.writes.length == processed) {
|
||||
await Future<dynamic>.delayed(const Duration(milliseconds: 5));
|
||||
}
|
||||
|
||||
String? boundaryKey;
|
||||
while(processed < frontendServerStdIn.writes.length) {
|
||||
while (processed < frontendServerStdIn.writes.length) {
|
||||
final List<int> data = frontendServerStdIn.writes[processed];
|
||||
final String stringData = utf8.decode(data);
|
||||
if (stringData.startsWith('compile ')) {
|
||||
|
||||
@@ -1060,10 +1060,10 @@ dependencies:
|
||||
const String newPluginName = 'flutterEngine.getPlugins().add(new plugin1.UseNewEmbedding());';
|
||||
const String oldPluginName = 'abcplugin1.UseOldEmbedding.registerWith(shimPluginRegistry.registrarFor("abcplugin1.UseOldEmbedding"));';
|
||||
final String content = registrant.readAsStringSync();
|
||||
for(final String plugin in <String>[newPluginName,oldPluginName]) {
|
||||
for (final String plugin in <String>[newPluginName,oldPluginName]) {
|
||||
expect(content, contains(plugin));
|
||||
expect(content.split(plugin).first.trim().endsWith('try {'), isTrue);
|
||||
expect(content.split(plugin).last.trim().startsWith('} catch(Exception e) {'), isTrue);
|
||||
expect(content.split(plugin).last.trim().startsWith('} catch (Exception e) {'), isTrue);
|
||||
}
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fs,
|
||||
|
||||
@@ -75,7 +75,7 @@ void main() {
|
||||
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
|
||||
final int vmServicePort = await getFreePort();
|
||||
int ddsPort = await getFreePort();
|
||||
while(ddsPort == vmServicePort) {
|
||||
while (ddsPort == vmServicePort) {
|
||||
ddsPort = await getFreePort();
|
||||
}
|
||||
// If both --dds-port and --vm-service-port are provided, --dds-port will be used by
|
||||
|
||||
@@ -357,11 +357,11 @@ PubspecEditor _setDartSDKVersionEditor(String version) {
|
||||
for (i++; i < lines.length; i++) {
|
||||
final String innerLine = lines[i];
|
||||
final String sdkLine = " sdk: '$version'";
|
||||
if(innerLine.isNotEmpty && !innerLine.startsWith(' ')) {
|
||||
if (innerLine.isNotEmpty && !innerLine.startsWith(' ')) {
|
||||
lines.insert(i, sdkLine);
|
||||
break;
|
||||
}
|
||||
if(innerLine.startsWith(' sdk:')) {
|
||||
if (innerLine.startsWith(' sdk:')) {
|
||||
lines[i] = sdkLine;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ Future<void> expectToolExitLater(Future<dynamic> future, Matcher messageMatcher)
|
||||
try {
|
||||
await future;
|
||||
fail('ToolExit expected, but nothing thrown');
|
||||
} on ToolExit catch(e) {
|
||||
} on ToolExit catch (e) {
|
||||
expect(e.message, messageMatcher);
|
||||
// Catch all exceptions to give a better test failure message.
|
||||
} catch (e, trace) { // ignore: avoid_catches_without_on_clauses
|
||||
|
||||
@@ -230,7 +230,7 @@ class FakePollingDeviceDiscovery extends PollingDeviceDiscovery {
|
||||
}
|
||||
|
||||
void setDevices(List<Device> devices) {
|
||||
while(_devices.isNotEmpty) {
|
||||
while (_devices.isNotEmpty) {
|
||||
_removeDevice(_devices.first);
|
||||
}
|
||||
devices.forEach(addDevice);
|
||||
|
||||
Reference in New Issue
Block a user