Speed constructor

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

Class for speed conversions, e.g. if you want to convert 1 square meters in acres:

var speed = Speed(removeTrailingZeros: false);
speed.convert(Unit(SPEED.square_meters, value: 1));
print(SPEED.acres);

Implementation

Speed(
    {this.significantFigures = 10,
    this.removeTrailingZeros = true,
    this.useScientificNotation = true,
    name}) {
  this.name = name ?? PROPERTY.speed;
  size = SPEED.values.length;
  Node conversionTree = Node(name: SPEED.metersPerSecond, leafNodes: [
    Node(
        coefficientProduct: 1 / 3.6,
        name: SPEED.kilometersPerHour,
        leafNodes: [
          Node(
            coefficientProduct: 1.609344,
            name: SPEED.milesPerHour,
          ),
          Node(
            coefficientProduct: 1.852,
            name: SPEED.knots,
          ),
          Node(
            conversionType: CONVERSION_TYPE.reciprocalConversion,
            coefficientProduct: 60,
            name: SPEED.minutesPerKilometer,
          )
        ]),
    Node(
      coefficientProduct: 0.3048,
      name: SPEED.feetsPerSecond,
    ),
  ]);

  _customConversion = CustomConversion(
      conversionTree: conversionTree,
      mapSymbols: mapSymbols,
      significantFigures: significantFigures,
      removeTrailingZeros: removeTrailingZeros,
      useScientificNotation: useScientificNotation);
}