Home > Back-end >  Why . sign used before number? in Dart/flutter
Why . sign used before number? in Dart/flutter

Time:06-27

What means sign . before number in Dart languge exemple (.59):

double width = .59 * MediaQuery.of(context).size.width;

CodePudding user response:

A decimal point, in other words it implies a leading zero.

e.g.

 print((.23.toStringAsFixed(3)));

output:

0.230

(though I don't see it specifically stated in the double class documentation, and not sure if that would be affected by locale/culture settings)

  • Related