Skip to content

Instantly share code, notes, and snippets.

@mosleim
Created October 15, 2021 09:07
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 mosleim/073e445055acf7186ba0f7e6677d3bd1 to your computer and use it in GitHub Desktop.
Save mosleim/073e445055acf7186ba0f7e6677d3bd1 to your computer and use it in GitHub Desktop.
Silly double in dart
class Numbering {
final double d;
Numbering({
required this.d,
});
factory Numbering.fromMap(Map<String, dynamic> map) {
return Numbering(
d: map['d'], // will error on flutter and working on dartpad
);
}
}
void main() {
final Map<String, dynamic> data = {"d": 0};
final n= Numbering.fromMap(data);
print(n.d.runtimeType); //working in dartpad, but this runtimeType will change to int. :-D
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment