Currency.create constructor

Currency.create(
  1. String isoCode,
  2. int decimalDigits, {
  3. String symbol = r'$',
  4. String pattern = defaultPattern,
  5. String groupSeparator = ',',
  6. String decimalSeparator = '.',
  7. String country = '',
  8. String unit = '',
  9. String name = '',
})

Creates a currency with a given isoCode and decimalDigits.

  • isoCode - the currency isoCode e.g. USD
  • decimalDigits - the number of digits after the decimal place the the currency uses. e.g. 2 for USD as it uses cents to 2 digits.
  • pattern - the default output format used when you call toString on a Money instance created with this currency. See Money.format for details on the supported patterns. groupSeparator controls the character used to separate blocks of 1000. e.g. 1,000,000. By default the groupSeparator is ',' decimalSeparator controls the character used for the decimal place. By default the decimalSeparator is '.'

Implementation

Currency.create(this.isoCode, this.decimalDigits,
    {this.symbol = r'$',
    this.pattern = defaultPattern,
    this.groupSeparator = ',',
    this.decimalSeparator = '.',
    this.country = '',
    this.unit = '',
    this.name = ''})
    : scaleFactor = Currency._calcPrecisionFactor(decimalDigits) {
  if (isoCode.isEmpty) {
    throw ArgumentError.value(
        isoCode, 'isoCode', 'Must be a non-empty string.');
  }
}