ListFormat constructor

ListFormat({
  1. Locale? locale,
  2. ListType type = ListType.and,
  3. ListStyle style = ListStyle.long,
})

Creates a new list formatter.

  • locale: The locale defining the formatting rules (e.g., 'en-US', 'es'). If null, uses the system locale.
  • type: Specifies the type of list concatenation. Defaults to ListType.and (for conjunction) or can be ListType.or (for disjunction).
  • style: The formatting style, such as ListStyle.long (e.g., "A, B, and C") or ListStyle.short (e.g., "A, B, & C"). Defaults to ListStyle.long.

Implementation

ListFormat({
  Locale? locale,
  ListType type = ListType.and,
  ListStyle style = ListStyle.long,
}) : _listFormatImpl = ListFormatImpl.build(
       locale ?? findSystemLocale(),
       ListFormatOptions(type: type, style: style),
     );