Unverified Commit 735fc296 authored by Christopher Fujino's avatar Christopher Fujino Committed by GitHub

[flutter_tools] refactor license collector (#128748)

Improve debugging for https://github.com/flutter/flutter/issues/128680

In the linked issue, I cannot explain how we are getting a type error. However, this refactor eliminates the null check operator (by iterating over `MapEntries` rather than the keys) in hopes that there will be a more descriptive error in the future. The correctness of this change is verified by the existing tests in https://github.com/flutter/flutter/blob/master/packages/flutter_tools/test/general.shard/license_collector_test.dart
parent f8e8d89b
...@@ -82,11 +82,10 @@ class LicenseCollector { ...@@ -82,11 +82,10 @@ class LicenseCollector {
} }
} }
final List<String> combinedLicensesList = packageLicenses.keys final List<String> combinedLicensesList = packageLicenses.entries
.map<String>((String license) { .map<String>((MapEntry<String, Set<String>> entry) {
final List<String> packageNames = packageLicenses[license]!.toList() final List<String> packageNames = entry.value.toList()..sort();
..sort(); return '${packageNames.join('\n')}\n\n${entry.key}';
return '${packageNames.join('\n')}\n\n$license';
}).toList(); }).toList();
combinedLicensesList.sort(); combinedLicensesList.sort();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment