tr method

Text tr(
  1. {List<String>? args,
  2. BuildContext? context,
  3. Map<String, String>? namedArgs,
  4. String? gender}

Main function for translate your language keys key Localization key 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 gender Gender switcher. Changes the localized string based on gender string


   "msg":"{} are written in the {} language",
   "msg_named":"Easy localization is written in the {lang} language",
   "msg_mixed":"{} are written in the {lang} language",
      "male":"Hi man ;) {}",
      "female":"Hello girl :) {}",
      "other":"Hello {}"
Text('msg').tr(args: ['Easy localization', 'Dart']), // args
Text('msg_named').tr(namedArgs: {'lang': 'Dart'}),   // namedArgs
Text('msg_mixed').tr(args: ['Easy localization'], namedArgs: {'lang': 'Dart'}), // args and namedArgs
Text('gender').tr(gender: _gender ? "female" : "male"), // gender


Text tr(
        {List<String>? args,
        BuildContext? context,
        Map<String, String>? namedArgs,
        String? gender}) =>
          data ?? '',
          context: context,
          args: args,
          namedArgs: namedArgs,
          gender: gender,
        key: key,
        style: style,
        strutStyle: strutStyle,
        textAlign: textAlign,
        textDirection: textDirection,
        locale: locale,
        softWrap: softWrap,
        overflow: overflow,
        textScaler: textScaler,
        maxLines: maxLines,
        semanticsLabel: semanticsLabel,
        textWidthBasis: textWidthBasis);