getMessage abstract method
The text for code in locale, with args filled into its {0},
{1}, ... placeholders.
When the code is not found, defaultMessage is formatted with args
instead; without one, a NoSuchMessageException is thrown. Without a
locale, only the default locale and the base file are consulted.
// "You have 3 items" in English.
source.getMessage('cart.items', args: [3], locale: 'en');
source.getMessage('missing', defaultMessage: 'Fallback {0}', args: [1]);
Implementation
String getMessage(
String code, {
List<Object?> args = const [],
String? defaultMessage,
String? locale,
});