List.unmodifiable should not accept an iterable of any type #52804
Labels
area-core-library
SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.
enhancement-breaking-change
An enhancement which is breaking.
library-core
type-enhancement
A request for a change that isn't a bug
Recently I bumped into a bug where some code was using a lot of
List.unmodifiable(someIterable)
to assign an unmodifiable list to aList<T>
. However, sinceList.unmodifiable
accepts anIterable<dynamic>
a type bug slipped through.This bug would have been prevented if the signature of
List.unmodifiable
wasList<T> List.unmodifiable(Iterable<T> input)
.Is there a specific reason why this type argument is the way it is?
Dart SDK version: 3.0.5 (stable) (Mon Jun 12 18:31:49 2023 +0000) on "macos_x64"
The text was updated successfully, but these errors were encountered: