Integer values no larger than 64 bits,depending on the platform.On the Dart VM, values can be from-263 to 263 - 1.Dart that’s compiled to JavaScript usesJavaScript numbers,allowing values from -253 to 253 - 1.
- 64-bit (double-precision) floating-point numbers, as specified bythe IEEE 754 standard.
Integers are numbers without a decimal point. Here are some examples ofdefining integer literals:
If a number includes a decimal, it is a double. Here are some examplesof defining double literals:
var y = 1.1;
var exponents = 1.42e5;
Version note: Before Dart 2.1, it was an error to use an integer literal in a double context.
Here’s how you turn a string into a number, or vice versa:
assert(one == 1);
// String -> double
var onePointOne = double.parse('1.1');
assert(onePointOne == 1.1);
// int -> String
assert(oneAsString == '1');
// double -> String
String piAsString = 3.14159.toStringAsFixed(2);
assert(piAsString == '3.14');
Literal numbers are compile-time constants.Many arithmetic expressions are also compile-time constants,as long as their operands arecompile-time constants that evaluate to numbers.
const msPerSecond = 1000;
const secondsUntilRetry = 5;