-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed as duplicate of#58359
Labels
P3A lower priority bug or feature requestA lower priority bug or feature requestarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-linterIssues with the analyzer's support for the linter packageIssues with the analyzer's support for the linter packagelinter-lint-proposallinter-status-pendingtype-enhancementA request for a change that isn't a bugA request for a change that isn't a bug
Description
use_of_instead_of_from
Description
The from ctor on collections is more expensive. It does casts. If possible, use the of constructor.
Details
If the source collection has a known, compatible type statically, of should be used.
Kind
Performance.
Bad Examples
final slowList = List<int>.from(someIterableOfInt);Good Examples
final fastList = List<int>.of(someIterableOfInt);Discussion
This should apply to List, Set, Map and related subtypes.
See 6fae002
orestesgaolin, rafalplonka and srawlins
Metadata
Metadata
Assignees
Labels
P3A lower priority bug or feature requestA lower priority bug or feature requestarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-linterIssues with the analyzer's support for the linter packageIssues with the analyzer's support for the linter packagelinter-lint-proposallinter-status-pendingtype-enhancementA request for a change that isn't a bugA request for a change that isn't a bug