Add spaces after flow control statements (#126320)

This commit is contained in:
Tomasz Gucio
2023-05-15 11:07:30 +02:00
committed by GitHub
parent 231e00d26b
commit 99c7e9f088
116 changed files with 264 additions and 174 deletions

View File

@@ -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,

View File

@@ -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];

View File

@@ -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(',');
}

View File

@@ -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) {

View File

@@ -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,

View File

@@ -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);

View File

@@ -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:

View File

@@ -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);

View File

@@ -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.');

View File

@@ -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}}

View File

@@ -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)) {

View File

@@ -515,7 +515,7 @@ class AndroidProject extends FlutterProjectPlatform {
}
File get appManifestFile {
if(isUsingGradle) {
if (isUsingGradle) {
return hostAppGradleRoot
.childDirectory('app')
.childDirectory('src')

View File

@@ -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');
}
}

View File

@@ -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.',