dart-lang / csslib

A library for parsing CSS.
https://pub.dev/packages/csslib
BSD 3-Clause "New" or "Revised" License
95 stars 38 forks source link

Correct a misused putIfAbsent call #109

Closed natebosch closed 4 years ago

natebosch commented 4 years ago

There is no need to assign within the callback for a putIfAbsent default. Refactor to the most idiomatic version today which is to use ??= (since we don't ever assign a null value so we don't care about the distinction between a missing key and a key assigned to null) and return the value directly rather than putting it in the Map and then pulling it back out.