Type Promotion
Noun · Development
Definitions
The automatic widening of a numeric value to a larger or more precise type during an operation (e.g., `int` to `long` or `float` to `double` in C/Java) to prevent overflow or precision loss. In Dart, the term also refers to flow-based type narrowing where a null check promotes a nullable type to non-nullable within a scope.
In plain English: When the compiler automatically upgrades a value to a bigger or more precise type to avoid losing data during a calculation.
Example: "Multiplying an int by a double triggers type promotion — the int is promoted to double before the multiplication happens."