Skip to content

Instantly share code, notes, and snippets.

@ArtemGr
Created December 11, 2019 05:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ArtemGr/7bc355b3b7779d2b37e1aae2b6def050 to your computer and use it in GitHub Desktop.
Save ArtemGr/7bc355b3b7779d2b37e1aae2b6def050 to your computer and use it in GitHub Desktop.
stackoverflow-33424185-2
// 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