'Why dart infers the variable type as a int when I explicitly say the type is double?

Here is the example from the doc

The doc says the Integer literals are automatically converted to doubles when necessary:

double z = 1; // Equivalent to double z = 1.0.

But when I check the runtimeType the type is int

print(z.runtimeType); // prints to int


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source