Implementing null-aware operators throughout the repository (#143804)
This pull request fixes #143803 by taking advantage of Dart's null-aware operators. And unlike `switch` expressions ([9 PRs](https://github.com/flutter/flutter/pull/143634) and counting), the Flutter codebase is already fantastic when it comes to null-aware coding. After refactoring the entire repo, all the changes involving `?.` and `??` can fit into a single pull request.
This commit is contained in:
@@ -521,11 +521,7 @@ class AndroidSdk {
|
||||
final String executable = globals.platform.isWindows
|
||||
? 'sdkmanager.bat'
|
||||
: 'sdkmanager';
|
||||
final String? path = getCmdlineToolsPath(executable, skipOldTools: true);
|
||||
if (path != null) {
|
||||
return path;
|
||||
}
|
||||
return null;
|
||||
return getCmdlineToolsPath(executable, skipOldTools: true);
|
||||
}
|
||||
|
||||
/// Returns the version of the Android SDK manager tool or null if not found.
|
||||
|
||||
@@ -163,11 +163,7 @@ class Java {
|
||||
RegExp(r'java\s+(?<version>\d+(\.\d+)?(\.\d+)?)\s+\d\d\d\d-\d\d-\d\d');
|
||||
final RegExpMatch? match = secondJdkVersionRegex.firstMatch(versionLines[0]);
|
||||
if (match != null) {
|
||||
final Version? parsedVersion = Version.parse(match.namedGroup('version'));
|
||||
if (parsedVersion == null) {
|
||||
return null;
|
||||
}
|
||||
return parsedVersion;
|
||||
return Version.parse(match.namedGroup('version'));
|
||||
}
|
||||
_logger.printWarning(_formatJavaVersionWarning(rawVersionOutput));
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user