string/icu_message_utils library
ICU-style message formatting lite: pluralization and select (gender) —
roadmap #414.
A pragmatic subset of ICU MessageFormat that covers the two cases apps
actually reach for — choosing a plural form and choosing a gendered/category
form — without a parser or the intl dependency. The existing
String.pluralize only appends an s; this picks among caller-supplied
forms and is locale-routable.
Functions
-
icuPlural(
int count, {required String other, String? one, String? zero}) → String -
Selects a plural form for
countand replaces every#in the chosen form with the count. -
icuSelect(
String value, Map< String, String> cases, {required String other}) → String -
ICU
selectlite: returns thecasesentry whose key equalsvalue, falling back tootherfor any missing or unknown key.