localizedFormat method
Formats using a localized format token.
Supported tokens:
LT- Time (e.g., "10:30 AM")LTS- Time with seconds (e.g., "10:30:45 AM")L- Short date (e.g., "12/25/2023")LL- Long date (e.g., "December 25, 2023")LLL- Long date with time (e.g., "December 25, 2023 10:30 AM")LLLL- Full format (e.g., "Thursday, December 25, 2023 10:30 AM")l,ll,lll,llll- Compact versions of above
You can also use these tokens within a larger format string.
Implementation
String localizedFormat(String pattern, {HoraFormats? formats}) {
final localeFormats = formats ?? locale.formats;
final expanded = _expandLocalizedTokens(pattern, localeFormats);
return format(expanded);
}