Decimal constructor

Decimal({
  1. required int precision,
  2. int? intValue,
  3. double? doubleValue,
})

Implementation

Decimal({required this.precision, int? intValue, double? doubleValue})
  : assert(precision >= 0, 'precision must be positive or zero'),
    assert(
      intValue == null || doubleValue == null,
      'intValue or doubleValue must be null',
    ),
    _doubleValue =
        double.tryParse(doubleValue?.toStringAsFixed(precision) ?? '') ??
        (intValue ?? 0).toDouble() / pow(10, precision);