Created
October 15, 2021 09:07
-
-
Save mosleim/073e445055acf7186ba0f7e6677d3bd1 to your computer and use it in GitHub Desktop.
Silly double in dart
This file contains hidden or 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
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