fromMicros static method

DVMoney fromMicros(
  1. String micros,
  2. String currency
)

A Play priceAmountMicros: millionths of the major unit, as the decimal string Play sends. A string, because the JSON number a parser would make of it is a double past 2^53.

Implementation

static DVMoney fromMicros(String micros, String currency) {
  if (!RegExp(r'^-?[0-9]+$').hasMatch(micros)) {
    throw FormatException('micros are an integer count', micros);
  }
  return _scaled(BigInt.parse(micros), 6, currency, 'micros');
}