Density constructor

Density({
  1. int significantFigures = 10,
  2. bool removeTrailingZeros = true,
  3. bool useScientificNotation = true,
  4. dynamic name,
})

Class for density conversions, e.g. if you want to convert 1 gram per liter in kilograms per liter:

var density = Density(removeTrailingZeros: false);
density.convert(Unit(DENSITY.gramsPerLiter, value: 1));
print(DENSITY.kilogramsPerLiter);

Implementation

Density(
    {super.significantFigures,
    super.removeTrailingZeros,
    super.useScientificNotation,
    name})
    : assert(_mapSymbols.length == DENSITY.values.length),
      super(
          name: name ?? PROPERTY.density,
          numeratorProperty:
              getPropertyFromEnum(DENSITY.values[0].numerator)!,
          denominatorProperty:
              getPropertyFromEnum(DENSITY.values[0].denominator)!,
          mapSymbols: _mapSymbols);