Skip to content

Instantly share code, notes, and snippets.

@stuartmorgan
Created February 16, 2022 00:13
Show Gist options
  • Save stuartmorgan/bb6c33398890a6b30c5c5a3db5bdf27f to your computer and use it in GitHub Desktop.
Save stuartmorgan/bb6c33398890a6b30c5c5a3db5bdf27f to your computer and use it in GitHub Desktop.
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);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment