plural method

String plural(
  1. num value,
  2. {List<String>? args,
  3. BuildContext? context,
  4. Map<String, String>? namedArgs,
  5. String? name,
  6. NumberFormat? format}

function translate with pluralization key Localization key value Number value for pluralization BuildContext The location in the tree where this widget builds args List of localized strings. Replaces {} left to right namedArgs Map of localized strings. Replaces the name keys {key_name} according to its name name Name of number value. Replaces {$name} to value format Formats a numeric value using a NumberFormat class


  "day": {
    "zero":"{} дней",
    "one": "{} день",
    "two": "{} дня",
    "few": "{} дня",
    "many": "{} дней",
    "other": "{} дней"
  "money": {
    "zero": "You not have money",
    "one": "You have {} dollar",
    "many": "You have {} dollars",
    "other": "You have {} dollars"
  "money_args": {
    "zero": "{} has no money",
    "one": "{} has {} dollar",
    "many": "{} has {} dollars",
    "other": "{} has {} dollars"
  "money_named_args": {
    "zero": "{name} has no money",
    "one": "{name} has {money} dollar",
    "many": "{name} has {money} dollars",
    "other": "{name} has {money} dollars"
Text('money').plural(1000000, format: NumberFormat.compact(locale: context.locale.toString())) // output: You have 1M dollars
print('day'.plural(21)); // output: 21 день
var money = plural('money', 10.23) // output: You have 10.23 dollars
var money = plural('money_args', 10.23, args: ['John', '10.23'])  // output: John has 10.23 dollars
var money = plural('money_named_args', 10.23, namedArgs: {'name': 'Jane'}, name: 'money')  // output: Jane has 10.23 dollars


String plural(
  num value, {
  List<String>? args,
  BuildContext? context,
  Map<String, String>? namedArgs,
  String? name,
  NumberFormat? format,
}) =>
      context: context,
      args: args,
      namedArgs: namedArgs,
      name: name,
      format: format,