SIPrefixes constructor

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

Class for si_prefixes conversions, e.g. if you want to convert 1 base unit in milli:

var si_prefixes = Si_Prefixes(removeTrailingZeros: false);
si_prefixes.convert(Unit(SI_PREFIXES.base, value: 1));
print(SI_PREFIXES.milli);

Implementation

SIPrefixes(
    {super.significantFigures,
    super.removeTrailingZeros,
    super.useScientificNotation,
    name})
    : super(
        name: name ?? PROPERTY.siPrefixes,
        mapSymbols: {
          SI_PREFIXES.deca: 'da-',
          SI_PREFIXES.hecto: 'h-',
          SI_PREFIXES.kilo: 'k-',
          SI_PREFIXES.mega: 'M-',
          SI_PREFIXES.giga: 'G-',
          SI_PREFIXES.tera: 'T-',
          SI_PREFIXES.peta: 'P-',
          SI_PREFIXES.exa: 'E-',
          SI_PREFIXES.zetta: 'Z-',
          SI_PREFIXES.yotta: 'Y-',
          SI_PREFIXES.deci: 'd-',
          SI_PREFIXES.centi: 'c-',
          SI_PREFIXES.milli: 'm-',
          SI_PREFIXES.micro: 'ยต-',
          SI_PREFIXES.nano: 'n-',
          SI_PREFIXES.pico: 'p-',
          SI_PREFIXES.femto: 'f-',
          SI_PREFIXES.atto: 'a-',
          SI_PREFIXES.zepto: 'z-',
          SI_PREFIXES.yocto: 'y-',
        },
        conversionTree: ConversionNode(name: SI_PREFIXES.base, children: [
          ConversionNode(
            coefficientProduct: 1e1,
            name: SI_PREFIXES.deca,
          ),
          ConversionNode(
            coefficientProduct: 1e2,
            name: SI_PREFIXES.hecto,
          ),
          ConversionNode(
            coefficientProduct: 1e3,
            name: SI_PREFIXES.kilo,
          ),
          ConversionNode(
            coefficientProduct: 1e6,
            name: SI_PREFIXES.mega,
          ),
          ConversionNode(
            coefficientProduct: 1e9,
            name: SI_PREFIXES.giga,
          ),
          ConversionNode(
            coefficientProduct: 1e12,
            name: SI_PREFIXES.tera,
          ),
          ConversionNode(
            coefficientProduct: 1e15,
            name: SI_PREFIXES.peta,
          ),
          ConversionNode(
            coefficientProduct: 1e18,
            name: SI_PREFIXES.exa,
          ),
          ConversionNode(
            coefficientProduct: 1e21,
            name: SI_PREFIXES.zetta,
          ),
          ConversionNode(
            coefficientProduct: 1e24,
            name: SI_PREFIXES.yotta,
          ),
          ConversionNode(
            coefficientProduct: 1e-1,
            name: SI_PREFIXES.deci,
          ),
          ConversionNode(
            coefficientProduct: 1e-2,
            name: SI_PREFIXES.centi,
          ),
          ConversionNode(
            coefficientProduct: 1e-3,
            name: SI_PREFIXES.milli,
          ),
          ConversionNode(
            coefficientProduct: 1e-6,
            name: SI_PREFIXES.micro,
          ),
          ConversionNode(
            coefficientProduct: 1e-9,
            name: SI_PREFIXES.nano,
          ),
          ConversionNode(
            coefficientProduct: 1e-12,
            name: SI_PREFIXES.pico,
          ),
          ConversionNode(
            coefficientProduct: 1e-15,
            name: SI_PREFIXES.femto,
          ),
          ConversionNode(
            coefficientProduct: 1e-18,
            name: SI_PREFIXES.atto,
          ),
          ConversionNode(
            coefficientProduct: 1e-21,
            name: SI_PREFIXES.zepto,
          ),
          ConversionNode(
            coefficientProduct: 1e-24,
            name: SI_PREFIXES.yocto,
          ),
        ]),
      );