Given code
List<int> rawList = [0, 1, 2];
BuiltList<int> list = rawList.map((n) => n * 2);
compiles successfully but fails at runtime with the error
type 'MappedListIterable<int, int>' is not a subtype of type 'BuiltList'
So why wouldn't it crash on compile stage? Please explain, after C# and Kotlin I can't understand that.
.mapreturns anIterable<int>, which doesn't fit in yourList<int>. You need to convert theIterableto aListwith.toList().