Skip to content

Instantly share code, notes, and snippets.

@stuartmorgan
stuartmorgan / collection_cast.dart
Created February 16, 2022 00:13
Casting example
void main() {
List<dynamic> allStrings = <dynamic>[];
allStrings.add('a');
List<String> good = allStrings.cast<String>();
print(good);
List<String> bad = allStrings as List<String>;
print(bad);
}