New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean up null assumptions for project.dart dependencies #83445
Conversation
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat. If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
@@ -334,10 +350,14 @@ class FlutterProject { | |||
|
|||
/// Returns a json encoded string containing the [appName], [version], and [buildNumber] that is used to generate version.json | |||
String getVersionInfo() { | |||
final String buildName = manifest.buildName; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method is mostly used to generate dep files.
Could also be convinced to set version
/build_number
value to an empty string instead.
if (_buildSettingsByBuildContext[buildContext] == null) { | ||
final Map<String, String> calculatedBuildSettings = await _xcodeProjectBuildSettings(buildContext); | ||
if (calculatedBuildSettings != null) { | ||
_buildSettingsByBuildContext[buildContext] = calculatedBuildSettings; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid setting a _buildSettingsByBuildContext value to null
.
@@ -975,12 +1004,13 @@ to migrate your project. | |||
logger: globals.logger, | |||
templateRenderer: globals.templateRenderer, | |||
); | |||
final String androidIdentifier = parent.manifest.androidPackage ?? 'com.example.${parent.manifest.appName}'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a good fallback, already used in
flutter/packages/flutter_tools/lib/src/android/deferred_components_prebuild_validator.dart
Line 271 in e7b7ebc
'androidIdentifier': FlutterProject.current().manifest.androidPackage ?? 'com.example.${FlutterProject.current().manifest.appName}', |
@@ -791,12 +819,13 @@ class IosProject extends FlutterProjectPlatform implements XcodeBasedProject { | |||
logger: globals.logger, | |||
templateRenderer: globals.templateRenderer, | |||
); | |||
final String iosBundleIdentifier = parent.manifest.iosBundleIdentifier ?? 'com.example.${parent.manifest.appName}'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See androidIdentifier
comment, parent.manifest.appName
seems like a fine fallback value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I started migrating
project.dart
and all its dependencies, and the diff was huge.Pull out the cleanup parts in project, flutter_plugins, and cmake (kind of a random grouping) that can be done without actually migrating to null safety.
Part of #71511