Dart library for handling units and values
See
DistanceConversion.convertValue(
DistanceUnit.KILOMETRES, DistanceUnit.YARD, 1.34) // 1465.4374
Distance distance = Distance(1.34, DistanceUnit.KILOMETRES);
distance.getValue(DistanceUnit.METRES); // 1340
distance.convert(DistanceUnit.METRES); // Distance(1340, DistanceUnit.METRES)
To avoid confusion among developers, there is no default unit for a measurement. Unit must be consciously supplied. If unit is known before hand, to avoid calculation measurements can be standardized.
Conversions are as far as possible generated before hand, best during compilation. Functions are looked up with O(1) complexity.
For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.