int literals should be double literals #27678
Labels
area-language
Dart language related items (some items might be better tracked at github.com/dart-lang/language).
type-enhancement
A request for a change that isn't a bug
The following isn't currently possible:
We commonly get complaints from our users that they receive the runtime error "type 'int' is not a subtype of type 'double'", or the analyzer warning "A value of type 'int' cannot be assigned to a variable of type 'double'", whenever they put literal numerics in their code. Literal numerics are very common in Flutter code. The problem is caused by users using integer literals where we expect doubles.
We would like to be able to accept integer literals where doubles are expected, with no runtime overhead (i.e. with the conversion done at compile time).
It seems like this should be relatively straight-forward in a strong mode environment.
The text was updated successfully, but these errors were encountered: