Decimal.fromString constructor

Decimal.fromString(
  1. String v
)

Construct an Decimal from a string.

See the Rust documentation for try_from_str for more information.

Throws DecimalParseError on failure.

Implementation

factory Decimal.fromString(String v) {
  final temp = _FinalizedArena();
  final result = _icu4x_Decimal_from_string_mv1(v._utf8AllocIn(temp.arena));
  if (!result.isOk) {
    throw DecimalParseError.values[result.union.err];
  }
  return Decimal._fromFfi(result.union.ok, []);
}