FuelConsumption constructor

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

Class for fuel_consumption conversions, e.g. if you want to convert 1 kilometers per liter in liters per 100 km:

var fuel_consumption = Fuel_Consumption(removeTrailingZeros: false);
fuel_consumption.convert(Unit(FUEL_CONSUMPTION.kilometers_per_liter, value: 1));
print(FUEL_CONSUMPTION.liters_per_100_km);

Implementation

FuelConsumption(
    {super.significantFigures,
    super.removeTrailingZeros,
    super.useScientificNotation,
    name})
    : super(
          name: name ?? PROPERTY.fuelConsumption,
          mapSymbols: {
            FUEL_CONSUMPTION.kilometersPerLiter: 'km/l',
            FUEL_CONSUMPTION.litersPer100km: 'l/100km',
            FUEL_CONSUMPTION.milesPerUsGallon: 'mpg',
            FUEL_CONSUMPTION.milesPerImperialGallon: 'mpg',
          },
          conversionTree: ConversionNode(
              name: FUEL_CONSUMPTION.kilometersPerLiter,
              children: [
                ConversionNode(
                  conversionType: ConversionType.reciprocalConversion,
                  coefficientProduct: 100.0,
                  name: FUEL_CONSUMPTION.litersPer100km,
                ),
                ConversionNode(
                  coefficientProduct: 0.4251437074,
                  name: FUEL_CONSUMPTION.milesPerUsGallon,
                ),
                ConversionNode(
                  coefficientProduct: 0.3540061899,
                  name: FUEL_CONSUMPTION.milesPerImperialGallon,
                ),
              ]));