Created
December 11, 2019 05:25
-
-
Save ArtemGr/7bc355b3b7779d2b37e1aae2b6def050 to your computer and use it in GitHub Desktop.
stackoverflow-33424185-2
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
// https://stackoverflow.com/questions/33424185/why-are-incorrect-type-assignments-allowed-in-dart | |
void main() { | |
Map<String, dynamic> map = { | |
'str': 'test', | |
'integer': 5, | |
'decimal': 1.5, | |
'list': [1,2,3] | |
}; | |
String s = map['decimal']; print(s); // JSDouble not String | |
int i = map['str']; print(i); // JSString not int | |
double d = map['list']; print(d); // JSArray not double | |
List l = map['integer']; print(l); // JSInt not List | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment