Wiki
Clone wikifling-units / AddingUnits
To add a new type of unit, perform the following:
1. Find the Interpreter for the measurement type associated with the unit in the /lib/src/measurements/
path (e.g. for a Mass unit, use MassInterpreter
)
2. Define a new static const
interpreter for the unit within the Interpreter class, with appropriate short name and multiplier (with respect to the SI unit):
static const _myUnits = MyMeasurementInterpreter._('mu', 0.5);
PressureInterpreter get pascals => PressureInterpreter._pascals._withPrefix(_prefix);
const myUnits = MyMeasurementInterpreter._myUnits;
NumExtension
class in /lib/src/extensions/extension.dart
:
/// Creates a MyUnit measurement. MyMeasurement get myUnits => MyMeasurementInterpreter._myUnits(this);
NumExtender
class in /lib/src/extensions/extender.dart
:
/// Creates a MyUnit measurement. MyMeasurement get myUnits => MyMeasurementInterpreter._myUnits._withPrefix(_prefix)(_value);
README.md
file, under Supported Features
Updated