Created
February 16, 2022 00:13
-
-
Save stuartmorgan/bb6c33398890a6b30c5c5a3db5bdf27f to your computer and use it in GitHub Desktop.
Casting example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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