Power constructor

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

Class for power conversions, e.g. if you want to convert 1 kilowatt in european horse power:

var power = Power(removeTrailingZeros: false);
power.convert(Unit(POWER.kilowatt, value: 1));
print(POWER.european_horse_power);

Implementation

Power(
    {super.significantFigures,
    super.removeTrailingZeros,
    super.useScientificNotation,
    name})
    : super(
        name: name ?? PROPERTY.power,
        mapSymbols: {
          POWER.watt: 'W',
          POWER.milliwatt: 'mW',
          POWER.kilowatt: 'kW',
          POWER.megawatt: 'MW',
          POWER.gigawatt: 'GW',
          POWER.europeanHorsePower: 'hp(M)',
          POWER.imperialHorsePower: 'hp(I)',
        },
        conversionTree: ConversionNode(name: POWER.watt, children: [
          ConversionNode(
            coefficientProduct: 1e-3,
            name: POWER.milliwatt,
          ),
          ConversionNode(
            coefficientProduct: 1e3,
            name: POWER.kilowatt,
          ),
          ConversionNode(
            coefficientProduct: 1e6,
            name: POWER.megawatt,
          ),
          ConversionNode(
            coefficientProduct: 1e9,
            name: POWER.gigawatt,
          ),
          ConversionNode(
            coefficientProduct: 735.49875,
            name: POWER.europeanHorsePower,
          ),
          ConversionNode(
            coefficientProduct: 745.69987158,
            name: POWER.imperialHorsePower,
          ),
        ]),
      );