-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: prefer
{List,Map}.of
over {List,Map}.from
Update the docs and a few test snippets to use `List.of` and `Map.of` instead of `List.from` and `Map.from`. The `of` factories offer better type-safety by enforcing the collection types at compile-time. Some instances of the `from` factories remain, as they are used for type promotion. To find such cases, run the regex: `(List|Map).*[.]from`. These cases align with Dart's documentation on `Map.from`: > Prefer using Map.of when possible, and only use Map.from to create > a new map with more precise types than the original, and when it's > known that all the keys and values have those more precise types.
- Loading branch information
Showing
3 changed files
with
9 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters