PluralRules.cardinal constructor

PluralRules.cardinal(
  1. DataProvider provider,
  2. Locale locale
)

Construct an `PluralRules` for the given locale, for cardinal numbers

See the Rust documentation for try_new_cardinal for more information.

Throws DataError on failure.

Implementation

factory PluralRules.cardinal(DataProvider provider, Locale locale) {
  final result = _icu4x_PluralRules_create_cardinal_mv1(provider._ffi, locale._ffi);
  if (!result.isOk) {
    throw DataError.values[result.union.err];
  }
  return PluralRules._fromFfi(result.union.ok, []);
}