DoubleProperty<T> constructor

DoubleProperty<T>({
  1. required ConversionNode<T> conversionTree,
  2. Map<T, String>? mapSymbols,
  3. dynamic name,
  4. int significantFigures = 10,
  5. bool removeTrailingZeros = true,
  6. bool useScientificNotation = true,
  7. String decimalSeparator = '.',
})

Implementation

DoubleProperty(
    {required this.conversionTree,
    this.mapSymbols,
    dynamic name,
    this.significantFigures = 10,
    this.removeTrailingZeros = true,
    this.useScientificNotation = true,
    this.decimalSeparator = '.'}) {
  assert(
    decimalSeparator.isNotEmpty,
    'The decimal separator cannot be empty',
  );
  this.name = name;
  _nodeList = _getTreeAsList();
  _mapNodes = {for (var node in _nodeList) node.name: node};
  size = _nodeList.length;
  _mapUnitsMap = {};
  for (final conversionNode in _nodeList) {
    final unit =
        Unit(conversionNode.name, symbol: mapSymbols?[conversionNode.name]);
    unit.stringValueCallback = (val) => valueToString(
          val,
          significantFigures,
          removeTrailingZeros,
          useScientificNotation,
          decimalSeparator,
        );
    _unitList.add(unit);
    _mapUnitsMap[conversionNode.name] = unit;
  }
}