Calendar.newWithProvider constructor

Calendar.newWithProvider(
  1. DataProvider provider,
  2. CalendarKind kind
)

Creates a new Calendar for the specified kind, using a particular data source.

See the Rust documentation for new for more information.

Throws DataError on failure.

Implementation

factory Calendar.newWithProvider(DataProvider provider, CalendarKind kind) {
  final result = _icu4x_Calendar_create_with_provider_mv1(provider._ffi, kind._ffi);
  if (!result.isOk) {
    throw DataError.values[result.union.err];
  }
  return Calendar._fromFfi(result.union.ok, []);
}