trPlural method
Creates a text widget that displays pluralized localization of a text based on the provided count
.
This function is an extension on Data
and uses the trPlural
method from a localization delegate
to handle the pluralization of the text based on the current locale set in the app context.
Parameters:
count
: The number to determine the form of pluralization.context
(optional): The build context that holds the locale information. If not provided, the function may use a default or fallback locale.
Returns:
A Text
widget displaying the localized, pluralized text with the specified style, alignment,
and text overflow handling.
Example:
Text trPluralWidget = yourDataObject.trPlural(3, context: context);
Implementation
Text trPlural(int count, {BuildContext? context}) {
return Text(
data!.trPlural(count, context),
style: style,
textAlign: textAlign,
overflow: overflow,
);
}