ListFormatter.andWithLength constructor

ListFormatter.andWithLength(
  1. Locale locale,
  2. ListLength length
)

Construct a new ListFormatter instance for And patterns from compiled data.

See the Rust documentation for try_new_and for more information.

Throws DataError on failure.

Implementation

factory ListFormatter.andWithLength(Locale locale, ListLength length) {
  final result = _icu4x_ListFormatter_create_and_with_length_mv1(locale._ffi, length.index);
  if (!result.isOk) {
    throw DataError.values[result.union.err];
  }
  return ListFormatter._fromFfi(result.union.ok, []);
}