Skip to content

Commit 263ea61

Browse files
authored
Use spread syntax instead of add (#3296)
1 parent 820b5ba commit 263ea61

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

lib/src/generator/empty_generator.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ class EmptyGenerator implements Generator {
1414
@override
1515
Future<void> generate(PackageGraph packageGraph) {
1616
logProgress(packageGraph.defaultPackage.documentationAsHtml);
17-
for (var package in {packageGraph.defaultPackage}
18-
..addAll(packageGraph.localPackages)) {
17+
for (var package in {
18+
packageGraph.defaultPackage,
19+
...packageGraph.localPackages
20+
}) {
1921
for (var category in filterNonDocumented(package.categories)) {
2022
logProgress(category.documentationAsHtml);
2123
}

testing/test_package/bin/drill.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void main(List<String> argList) {
3838
'INVOCATION_INDEX',
3939
'PACKAGE_INVOCATION_INDEX',
4040
]);
41-
Map<String, String> env = <String, String>{}..addAll(Platform.environment);
41+
Map<String, String> env = <String, String>{...Platform.environment};
4242
env.removeWhere((String key, String value) => !variableNames.contains(key));
4343
env.updateAll(
4444
(key, value) => inputFileRegExp.hasMatch(value) ? '<INPUT_FILE>' : value);

tool/subprocess_launcher.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,7 @@ class SubprocessLauncher {
175175
Map<String, String>? environment,
176176
bool includeParentEnvironment = true,
177177
void Function(String)? perLine}) async {
178-
environment = {}
179-
..addAll(environmentDefaults)
180-
..addAll(environment ?? {});
178+
environment = {...environmentDefaults, ...?environment};
181179
var jsonObjects = <Map<String, Object?>>[];
182180

183181
/// Allow us to pretend we didn't pass the JSON flag in to dartdoc by

0 commit comments

Comments
 (0)