Collator.createWithProvider constructor

Collator.createWithProvider(
  1. DataProvider provider,
  2. Locale locale,
  3. CollatorOptions options
)

Construct a new Collator instance using a particular data source.

See the Rust documentation for try_new for more information.

Throws DataError on failure.

Implementation

factory Collator.createWithProvider(DataProvider provider, Locale locale, CollatorOptions options) {
  final temp = _FinalizedArena();
  final result = _icu4x_Collator_create_v1_with_provider_mv1(provider._ffi, locale._ffi, options._toFfi(temp.arena));
  if (!result.isOk) {
    throw DataError.values[result.union.err];
  }
  return Collator._fromFfi(result.union.ok, []);
}