-
Notifications
You must be signed in to change notification settings - Fork 213
Annoying to have to write double literals for integer values. #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
request
Requests to resolve a particular developer problem
Comments
That's all over the place in Flutter. Not sure why they didn't use |
5 tasks
Closing, this is tracked in implementation issue #20 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In Dart, unlike many other languages, integers and doubles are objects, not "primitive values". There are no special rules converting between the types on assignment (assignment generally preserves the identity of objects).
This can be annoying when you want to write something simple, like:
Here the integer number isn't allowed where a double is expected, so the program fails to compile. You have to write it as
10.0
and42.0
to get the program compiling. This is annoying, and it feels like needless overhead when the meaning is clear.I would be nice if you didn't have to write the extra
.0
, the compiler should be able to figure that out.Proposed solutions: #4
The text was updated successfully, but these errors were encountered: