[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
This commit is contained in:
parent
f8e8d89b85
commit
735fc29622
@ -82,11 +82,10 @@ class LicenseCollector {
|
||||
}
|
||||
}
|
||||
|
||||
final List<String> combinedLicensesList = packageLicenses.keys
|
||||
.map<String>((String license) {
|
||||
final List<String> packageNames = packageLicenses[license]!.toList()
|
||||
..sort();
|
||||
return '${packageNames.join('\n')}\n\n$license';
|
||||
final List<String> combinedLicensesList = packageLicenses.entries
|
||||
.map<String>((MapEntry<String, Set<String>> entry) {
|
||||
final List<String> packageNames = entry.value.toList()..sort();
|
||||
return '${packageNames.join('\n')}\n\n${entry.key}';
|
||||
}).toList();
|
||||
combinedLicensesList.sort();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user