[flutter_tool] Use curly braces around single statment control structures (#40446)

diff --git a/packages/flutter_tools/lib/src/ios/code_signing.dart b/packages/flutter_tools/lib/src/ios/code_signing.dart
index b238435..677defd 100644
--- a/packages/flutter_tools/lib/src/ios/code_signing.dart
+++ b/packages/flutter_tools/lib/src/ios/code_signing.dart
@@ -110,8 +110,9 @@
     return null;
   }
 
-  if (isNotEmpty(buildSettings['PROVISIONING_PROFILE']))
+  if (isNotEmpty(buildSettings['PROVISIONING_PROFILE'])) {
     return null;
+  }
 
   // If the user's environment is missing the tools needed to find and read
   // certificates, abandon. Tools should be pre-equipped on macOS.
@@ -184,8 +185,9 @@
   // Don't care about the result.
   unawaited(opensslProcess.stderr.drain<String>());
 
-  if (await opensslProcess.exitCode != 0)
+  if (await opensslProcess.exitCode != 0) {
     return null;
+  }
 
   return <String, String>{
     'DEVELOPMENT_TEAM': _certificateOrganizationalUnitExtractionPattern
@@ -201,8 +203,9 @@
     throwToolExit('No development certificates available to code sign app for device deployment');
   }
 
-  if (validCodeSigningIdentities.length == 1)
+  if (validCodeSigningIdentities.length == 1) {
     return validCodeSigningIdentities.first;
+  }
 
   if (validCodeSigningIdentities.length > 1) {
     final String savedCertChoice = config.getValue('ios-signing-cert');
@@ -218,8 +221,9 @@
 
     // If terminal UI can't be used, just attempt with the first valid certificate
     // since we can't ask the user.
-    if (!terminal.usesTerminalUi)
+    if (!terminal.usesTerminalUi) {
       return validCodeSigningIdentities.first;
+    }
 
     final int count = validCodeSigningIdentities.length;
     printStatus(
diff --git a/packages/flutter_tools/lib/src/ios/devices.dart b/packages/flutter_tools/lib/src/ios/devices.dart
index 3d0f1f5..803e416 100644
--- a/packages/flutter_tools/lib/src/ios/devices.dart
+++ b/packages/flutter_tools/lib/src/ios/devices.dart
@@ -167,14 +167,16 @@
     if (!platform.isMacOS) {
       throw UnsupportedError('Control of iOS devices or simulators only supported on Mac OS.');
     }
-    if (!iMobileDevice.isInstalled)
+    if (!iMobileDevice.isInstalled) {
       return <IOSDevice>[];
+    }
 
     final List<IOSDevice> devices = <IOSDevice>[];
     for (String id in (await iMobileDevice.getAvailableDeviceIDs()).split('\n')) {
       id = id.trim();
-      if (id.isEmpty)
+      if (id.isEmpty) {
         continue;
+      }
 
       try {
         final String deviceName = await iMobileDevice.getInfoForDevice(id, 'DeviceName');
@@ -287,8 +289,9 @@
         return LaunchResult.failed();
       }
     } else {
-      if (!await installApp(package))
+      if (!await installApp(package)) {
         return LaunchResult.failed();
+      }
     }
 
     // Step 2: Check that the application exists at the specified path.
@@ -302,19 +305,22 @@
     // Step 3: Attempt to install the application on the device.
     final List<String> launchArguments = <String>['--enable-dart-profiling'];
 
-    if (debuggingOptions.startPaused)
+    if (debuggingOptions.startPaused) {
       launchArguments.add('--start-paused');
+    }
 
-    if (debuggingOptions.disableServiceAuthCodes)
+    if (debuggingOptions.disableServiceAuthCodes) {
       launchArguments.add('--disable-service-auth-codes');
+    }
 
     if (debuggingOptions.dartFlags.isNotEmpty) {
       final String dartFlags = debuggingOptions.dartFlags;
       launchArguments.add('--dart-flags="$dartFlags"');
     }
 
-    if (debuggingOptions.useTestFonts)
+    if (debuggingOptions.useTestFonts) {
       launchArguments.add('--use-test-fonts');
+    }
 
     // "--enable-checked-mode" and "--verify-entry-points" should always be
     // passed when we launch debug build via "ios-deploy". However, we don't
@@ -327,24 +333,29 @@
       launchArguments.add('--verify-entry-points');
     }
 
-    if (debuggingOptions.enableSoftwareRendering)
+    if (debuggingOptions.enableSoftwareRendering) {
       launchArguments.add('--enable-software-rendering');
+    }
 
-    if (debuggingOptions.skiaDeterministicRendering)
+    if (debuggingOptions.skiaDeterministicRendering) {
       launchArguments.add('--skia-deterministic-rendering');
+    }
 
-    if (debuggingOptions.traceSkia)
+    if (debuggingOptions.traceSkia) {
       launchArguments.add('--trace-skia');
+    }
 
-    if (debuggingOptions.dumpSkpOnShaderCompilation)
+    if (debuggingOptions.dumpSkpOnShaderCompilation) {
       launchArguments.add('--dump-skp-on-shader-compilation');
+    }
 
     if (debuggingOptions.verboseSystemLogs) {
       launchArguments.add('--verbose-logging');
     }
 
-    if (platformArgs['trace-startup'] ?? false)
+    if (platformArgs['trace-startup'] ?? false) {
       launchArguments.add('--trace-startup');
+    }
 
     final Status installStatus = logger.startProgress(
         'Installing and launching...',
@@ -547,8 +558,9 @@
       _process.stdout.transform<String>(utf8.decoder).transform<String>(const LineSplitter()).listen(_newLineHandler());
       _process.stderr.transform<String>(utf8.decoder).transform<String>(const LineSplitter()).listen(_newLineHandler());
       _process.exitCode.whenComplete(() {
-        if (_linesController.hasListener)
+        if (_linesController.hasListener) {
           _linesController.close();
+        }
       });
     });
   }
@@ -604,8 +616,9 @@
   @override
   Future<int> forward(int devicePort, { int hostPort }) async {
     final bool autoselect = hostPort == null || hostPort == 0;
-    if (autoselect)
+    if (autoselect) {
       hostPort = 1024;
+    }
 
     Process process;
 
@@ -629,8 +642,9 @@
       if (!connected) {
         if (autoselect) {
           hostPort += 1;
-          if (hostPort > 65535)
+          if (hostPort > 65535) {
             throw Exception('Could not find open port on host.');
+          }
         } else {
           throw Exception('Port $hostPort is not available.');
         }
diff --git a/packages/flutter_tools/lib/src/ios/ios_emulators.dart b/packages/flutter_tools/lib/src/ios/ios_emulators.dart
index a3bd885..48d40ee 100644
--- a/packages/flutter_tools/lib/src/ios/ios_emulators.dart
+++ b/packages/flutter_tools/lib/src/ios/ios_emulators.dart
@@ -56,8 +56,9 @@
     }
 
     // First run with `-n` to force a device to boot if there isn't already one
-    if (!await launchSimulator(<String>['-n']))
+    if (!await launchSimulator(<String>['-n'])) {
       return;
+    }
 
     // Run again to force it to Foreground (using -n doesn't force existing
     // devices to the foreground)
diff --git a/packages/flutter_tools/lib/src/ios/mac.dart b/packages/flutter_tools/lib/src/ios/mac.dart
index 8749ec8..7fff383 100644
--- a/packages/flutter_tools/lib/src/ios/mac.dart
+++ b/packages/flutter_tools/lib/src/ios/mac.dart
@@ -181,8 +181,9 @@
           <MapEntry<String, String>>[cache.dyLdLibEntry]
         ),
       );
-      if (result.exitCode != 0)
+      if (result.exitCode != 0) {
         throw ToolExit('idevice_id returned an error:\n${result.stderr}');
+      }
       return result.stdout;
     } on ProcessException {
       throw ToolExit('Failed to invoke idevice_id. Run flutter doctor.');
@@ -203,8 +204,9 @@
           <MapEntry<String, String>>[cache.dyLdLibEntry]
         ),
       );
-      if (result.exitCode == 255 && result.stdout != null && result.stdout.contains('No device found'))
+      if (result.exitCode == 255 && result.stdout != null && result.stdout.contains('No device found')) {
         throw IOSDeviceNotFoundError('ideviceinfo could not find device:\n${result.stdout}. Try unlocking attached devices.');
+      }
       if (result.exitCode == 255 && result.stderr != null && result.stderr.contains('Could not connect to lockdownd')) {
         if (result.stderr.contains('error code -${LockdownReturnCode.pairingDialogResponsePending.code}')) {
           throw const IOSDeviceNotTrustedError(
@@ -219,8 +221,9 @@
           );
         }
       }
-      if (result.exitCode != 0)
+      if (result.exitCode != 0) {
         throw ToolExit('ideviceinfo returned an error:\n${result.stderr}');
+      }
       return result.stdout.trim();
     } on ProcessException {
       throw ToolExit('Failed to invoke ideviceinfo. Run flutter doctor.');
@@ -265,11 +268,13 @@
   bool codesign = true,
 
 }) async {
-  if (!upgradePbxProjWithFlutterAssets(app.project))
+  if (!upgradePbxProjWithFlutterAssets(app.project)) {
     return XcodeBuildResult(success: false);
+  }
 
-  if (!_checkXcodeVersion())
+  if (!_checkXcodeVersion()) {
     return XcodeBuildResult(success: false);
+  }
 
 
   final XcodeProjectInfo projectInfo = await xcodeProjectInterpreter.getInfo(app.project.hostAppRoot.path);
@@ -545,8 +550,9 @@
   final String generatedXcconfigPath =
       fs.path.join(fs.currentDirectory.path, appPath, 'Flutter', 'Generated.xcconfig');
   final File generatedXcconfigFile = fs.file(generatedXcconfigPath);
-  if (!generatedXcconfigFile.existsSync())
+  if (!generatedXcconfigFile.existsSync()) {
     return null;
+  }
   return generatedXcconfigFile.readAsStringSync();
 }
 
@@ -636,8 +642,9 @@
 const String _xcodeRequirement = 'Xcode $kXcodeRequiredVersionMajor.$kXcodeRequiredVersionMinor or greater is required to develop for iOS.';
 
 bool _checkXcodeVersion() {
-  if (!platform.isMacOS)
+  if (!platform.isMacOS) {
     return false;
+  }
   if (!xcodeProjectInterpreter.isInstalled) {
     printError('Cannot find "xcodebuild". $_xcodeRequirement');
     return false;
@@ -711,8 +718,9 @@
   for (final String line in lines) {
     final Match match = oldAssets.firstMatch(line);
     if (match != null) {
-      if (printedStatuses.add(match.group(1)))
+      if (printedStatuses.add(match.group(1))) {
         printStatus('Removing obsolete reference to ${match.group(1)} from ${project.hostAppBundleName}');
+      }
     } else {
       buffer.writeln(line);
     }
diff --git a/packages/flutter_tools/lib/src/ios/plist_parser.dart b/packages/flutter_tools/lib/src/ios/plist_parser.dart
index f626fe6..c873c3d 100644
--- a/packages/flutter_tools/lib/src/ios/plist_parser.dart
+++ b/packages/flutter_tools/lib/src/ios/plist_parser.dart
@@ -28,10 +28,12 @@
   Map<String, dynamic> parseFile(String plistFilePath) {
     assert(plistFilePath != null);
     const String executable = '/usr/bin/plutil';
-    if (!fs.isFileSync(executable))
+    if (!fs.isFileSync(executable)) {
       throw const FileNotFoundException(executable);
-    if (!fs.isFileSync(plistFilePath))
+    }
+    if (!fs.isFileSync(plistFilePath)) {
       return const <String, dynamic>{};
+    }
 
     final String normalizedPlistPath = fs.path.absolute(plistFilePath);
 
diff --git a/packages/flutter_tools/lib/src/ios/simulators.dart b/packages/flutter_tools/lib/src/ios/simulators.dart
index a8f912c..073716a 100644
--- a/packages/flutter_tools/lib/src/ios/simulators.dart
+++ b/packages/flutter_tools/lib/src/ios/simulators.dart
@@ -47,8 +47,9 @@
   static IOSSimulatorUtils get instance => context.get<IOSSimulatorUtils>();
 
   Future<List<IOSSimulator>> getAttachedDevices() async {
-    if (!xcode.isInstalledAndMeetsVersionCheck)
+    if (!xcode.isInstalledAndMeetsVersionCheck) {
       return <IOSSimulator>[];
+    }
 
     final List<SimDevice> connected = await SimControl.instance.getConnectedDevices();
     return connected.map<IOSSimulator>((SimDevice device) {
@@ -327,8 +328,9 @@
 
   @override
   String supportMessage() {
-    if (isSupported())
+    if (isSupported()) {
       return 'Supported';
+    }
 
     return _supportMessage ?? 'Unknown';
   }
@@ -353,35 +355,42 @@
         return LaunchResult.failed();
       }
     } else {
-      if (!await installApp(package))
+      if (!await installApp(package)) {
         return LaunchResult.failed();
+      }
     }
 
     // Prepare launch arguments.
     final List<String> args = <String>['--enable-dart-profiling'];
 
     if (debuggingOptions.debuggingEnabled) {
-      if (debuggingOptions.buildInfo.isDebug)
+      if (debuggingOptions.buildInfo.isDebug) {
         args.addAll(<String>[
           '--enable-checked-mode',
           '--verify-entry-points',
         ]);
-      if (debuggingOptions.startPaused)
+      }
+      if (debuggingOptions.startPaused) {
         args.add('--start-paused');
-      if (debuggingOptions.disableServiceAuthCodes)
+      }
+      if (debuggingOptions.disableServiceAuthCodes) {
         args.add('--disable-service-auth-codes');
-      if (debuggingOptions.skiaDeterministicRendering)
+      }
+      if (debuggingOptions.skiaDeterministicRendering) {
         args.add('--skia-deterministic-rendering');
-      if (debuggingOptions.useTestFonts)
+      }
+      if (debuggingOptions.useTestFonts) {
         args.add('--use-test-fonts');
+      }
       final int observatoryPort = debuggingOptions.observatoryPort ?? 0;
       args.add('--observatory-port=$observatoryPort');
     }
 
     ProtocolDiscovery observatoryDiscovery;
-    if (debuggingOptions.debuggingEnabled)
+    if (debuggingOptions.debuggingEnabled) {
       observatoryDiscovery = ProtocolDiscovery.observatory(
           getLogReader(app: package), ipv6: ipv6);
+    }
 
     // Launch the updated application in the simulator.
     try {
@@ -434,14 +443,16 @@
       targetOverride: mainPath,
       buildForDevice: false,
     );
-    if (!buildResult.success)
+    if (!buildResult.success) {
       throwToolExit('Could not build the application for the simulator.');
+    }
 
     // Step 2: Assert that the Xcode project was successfully built.
     final Directory bundle = fs.directory(app.simulatorBundlePath);
     final bool bundleExists = bundle.existsSync();
-    if (!bundleExists)
+    if (!bundleExists) {
       throwToolExit('Could not find the built application bundle at ${bundle.path}.');
+    }
 
     // Step 3: Install the updated bundle to the simulator.
     await SimControl.instance.install(id, fs.path.absolute(bundle.path));
@@ -504,8 +515,9 @@
   Future<void> ensureLogsExists() async {
     if (await sdkMajorVersion < 11) {
       final File logFile = fs.file(logFilePath);
-      if (!logFile.existsSync())
+      if (!logFile.existsSync()) {
         logFile.writeAsBytesSync(<int>[]);
+      }
     }
   }
 
@@ -594,8 +606,9 @@
     // We don't want to wait for the process or its callback. Best effort
     // cleanup in the callback.
     unawaited(_deviceProcess.exitCode.whenComplete(() {
-      if (_linesController.hasListener)
+      if (_linesController.hasListener) {
         _linesController.close();
+      }
     }));
   }
 
@@ -618,39 +631,48 @@
       final String content = match.group(4);
 
       // Filter out non-Flutter originated noise from the engine.
-      if (_appName != null && category != _appName)
+      if (_appName != null && category != _appName) {
         return null;
+      }
 
-      if (tag != null && tag != '(Flutter)')
+      if (tag != null && tag != '(Flutter)') {
         return null;
+      }
 
       // Filter out some messages that clearly aren't related to Flutter.
-      if (string.contains(': could not find icon for representation -> com.apple.'))
+      if (string.contains(': could not find icon for representation -> com.apple.')) {
         return null;
+      }
 
       // assertion failed: 15G1212 13E230: libxpc.dylib + 57882 [66C28065-C9DB-3C8E-926F-5A40210A6D1B]: 0x7d
-      if (content.startsWith('assertion failed: ') && content.contains(' libxpc.dylib '))
+      if (content.startsWith('assertion failed: ') && content.contains(' libxpc.dylib ')) {
         return null;
+      }
 
-      if (_appName == null)
+      if (_appName == null) {
         return '$category: $content';
-      else if (category == _appName)
+      } else if (category == _appName) {
         return content;
+      }
 
       return null;
     }
 
-    if (string.startsWith('Filtering the log data using '))
+    if (string.startsWith('Filtering the log data using ')) {
       return null;
+    }
 
-    if (string.startsWith('Timestamp                       (process)[PID]'))
+    if (string.startsWith('Timestamp                       (process)[PID]')) {
       return null;
+    }
 
-    if (_lastMessageSingleRegex.matchAsPrefix(string) != null)
+    if (_lastMessageSingleRegex.matchAsPrefix(string) != null) {
       return null;
+    }
 
-    if (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;
   }
@@ -665,13 +687,15 @@
       if (_lastLine != null) {
         int repeat = int.parse(multi.group(1));
         repeat = math.max(0, math.min(100, repeat));
-        for (int i = 1; i < repeat; i++)
+        for (int i = 1; i < repeat; i++) {
           _linesController.add(_lastLine);
+        }
       }
     } else {
       _lastLine = _filterDeviceLine(line);
-      if (_lastLine != null)
+      if (_lastLine != null) {
         _linesController.add(_lastLine);
+      }
     }
   }
 
@@ -682,12 +706,14 @@
 
   void _onSystemLine(String line) {
     printTrace('[SYS LOG] $line');
-    if (!_flutterRunnerRegex.hasMatch(line))
+    if (!_flutterRunnerRegex.hasMatch(line)) {
       return;
+    }
 
     final String filteredLine = _filterSystemLog(line);
-    if (filteredLine == null)
+    if (filteredLine == null) {
       return;
+    }
 
     _linesController.add(filteredLine);
   }
@@ -706,8 +732,9 @@
   while (i < v1Fragments.length && i < v2Fragments.length) {
     final int v1Fragment = v1Fragments[i];
     final int v2Fragment = v2Fragments[i];
-    if (v1Fragment != v2Fragment)
+    if (v1Fragment != v2Fragment) {
       return v1Fragment.compareTo(v2Fragment);
+    }
     i += 1;
   }
   return v1Fragments.length.compareTo(v2Fragments.length);
@@ -731,8 +758,9 @@
   final int v1 = int.parse(m1[1]);
   final int v2 = int.parse(m2[1]);
 
-  if (v1 != v2)
+  if (v1 != v2) {
     return v1.compareTo(v2);
+  }
 
   // Sorted in the least preferred first order.
   const List<String> qualifiers = <String>['-Plus', '', 's-Plus', 's'];
diff --git a/packages/flutter_tools/lib/src/ios/xcodeproj.dart b/packages/flutter_tools/lib/src/ios/xcodeproj.dart
index 8723faf..f8c3bd0 100644
--- a/packages/flutter_tools/lib/src/ios/xcodeproj.dart
+++ b/packages/flutter_tools/lib/src/ios/xcodeproj.dart
@@ -136,8 +136,9 @@
   xcodeBuildSettings.add('FLUTTER_APPLICATION_PATH=${fs.path.normalize(project.directory.path)}');
 
   // Relative to FLUTTER_APPLICATION_PATH, which is [Directory.current].
-  if (targetOverride != null)
+  if (targetOverride != null) {
     xcodeBuildSettings.add('FLUTTER_TARGET=$targetOverride');
+  }
 
   // The build outputs directory, relative to FLUTTER_APPLICATION_PATH.
   xcodeBuildSettings.add('FLUTTER_BUILD_DIR=${buildDirOverride ?? getBuildDirectory()}');
@@ -219,8 +220,9 @@
       }
       _versionText = result.stdout.trim().replaceAll('\n', ', ');
       final Match match = _versionRegex.firstMatch(versionText);
-      if (match == null)
+      if (match == null) {
         return;
+      }
       final String version = match.group(1);
       final List<String> components = version.split('.');
       _majorVersion = int.parse(components[0]);
@@ -234,22 +236,25 @@
 
   String _versionText;
   String get versionText {
-    if (_versionText == null)
+    if (_versionText == null) {
       _updateVersion();
+    }
     return _versionText;
   }
 
   int _majorVersion;
   int get majorVersion {
-    if (_majorVersion == null)
+    if (_majorVersion == null) {
       _updateVersion();
+    }
     return _majorVersion;
   }
 
   int _minorVersion;
   int get minorVersion {
-    if (_minorVersion == null)
+    if (_minorVersion == null) {
       _updateVersion();
+    }
     return _minorVersion;
   }
 
@@ -367,8 +372,9 @@
 /// project and target.
 String substituteXcodeVariables(String str, Map<String, String> xcodeBuildSettings) {
   final Iterable<Match> matches = _varExpr.allMatches(str);
-  if (matches.isEmpty)
+  if (matches.isEmpty) {
     return str;
+  }
 
   return str.replaceAllMapped(_varExpr, (Match m) => xcodeBuildSettings[m[1]] ?? m[0]);
 }
@@ -400,8 +406,9 @@
       }
       collector?.add(line.trim());
     }
-    if (schemes.isEmpty)
+    if (schemes.isEmpty) {
       schemes.add('Runner');
+    }
     return XcodeProjectInfo(targets, buildConfigurations, schemes);
   }
 
@@ -425,10 +432,10 @@
   /// The expected build configuration for [buildInfo] and [scheme].
   static String expectedBuildConfigurationFor(BuildInfo buildInfo, String scheme) {
     final String baseConfiguration = _baseConfigurationFor(buildInfo);
-    if (buildInfo.flavor == null)
+    if (buildInfo.flavor == null) {
       return baseConfiguration;
-    else
-      return baseConfiguration + '-$scheme';
+    }
+    return baseConfiguration + '-$scheme';
   }
 
   /// Checks whether the [buildConfigurations] contains the specified string, without
@@ -446,8 +453,9 @@
   /// best match.
   String schemeFor(BuildInfo buildInfo) {
     final String expectedScheme = expectedSchemeFor(buildInfo);
-    if (schemes.contains(expectedScheme))
+    if (schemes.contains(expectedScheme)) {
       return expectedScheme;
+    }
     return _uniqueMatch(schemes, (String candidate) {
       return candidate.toLowerCase() == expectedScheme.toLowerCase();
     });
@@ -457,32 +465,35 @@
   /// null, if there is no unique best match.
   String buildConfigurationFor(BuildInfo buildInfo, String scheme) {
     final String expectedConfiguration = expectedBuildConfigurationFor(buildInfo, scheme);
-    if (hasBuildConfiguratinForBuildMode(expectedConfiguration))
+    if (hasBuildConfiguratinForBuildMode(expectedConfiguration)) {
       return expectedConfiguration;
+    }
     final String baseConfiguration = _baseConfigurationFor(buildInfo);
     return _uniqueMatch(buildConfigurations, (String candidate) {
       candidate = candidate.toLowerCase();
-      if (buildInfo.flavor == null)
+      if (buildInfo.flavor == null) {
         return candidate == expectedConfiguration.toLowerCase();
-      else
-        return candidate.contains(baseConfiguration.toLowerCase()) && candidate.contains(scheme.toLowerCase());
+      }
+      return candidate.contains(baseConfiguration.toLowerCase()) && candidate.contains(scheme.toLowerCase());
     });
   }
 
   static String _baseConfigurationFor(BuildInfo buildInfo) {
-    if (buildInfo.isDebug)
+    if (buildInfo.isDebug) {
       return 'Debug';
-    if (buildInfo.isProfile)
+    }
+    if (buildInfo.isProfile) {
       return 'Profile';
+    }
     return 'Release';
   }
 
   static String _uniqueMatch(Iterable<String> strings, bool matches(String s)) {
     final List<String> options = strings.where(matches).toList();
-    if (options.length == 1)
+    if (options.length == 1) {
       return options.first;
-    else
-      return null;
+    }
+    return null;
   }
 
   @override