PluralRules.ordinalWithProvider constructor

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

Construct an PluralRules for the given locale, for ordinal numbers, using a particular data source.

See the Rust documentation for try_new_ordinal for more information.

Throws DataError on failure.

Implementation

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