toDecimal function

Decimal toDecimal(
  1. dynamic value
)

Implementation

Decimal toDecimal(dynamic value) {
  assert(value is num || value is Rational || value is String);

  if (value is num) {
    return MatexDecimal.fromNumber(value);
  } else if (value is Rational) {
    return MatexDecimal.fromRational(value);
  }

  return Decimal.parse(value as String);
}