I want to create a drop down menu for gender.
enum Gender {
male,
female,
}
final localization = AppLocalizations.of(context)!;
DropdownButtonFormField(
hint: Text(localization.gender),
items: Gender.values
.map((item) => DropdownMenuItem<Gender>(
value: item,
// TODO: translate
child: Text(item.name),
))
.toList(),
),
app_fa.arb:
{
"gender": "جنسیت",
"male": "مرد",
"female": "زن"
}
Everything works well, just I don't know how should I translate 'male' and 'female' and put them in menu items. I need a method which translates a string using keys in .arb file.
I'm using flutter_localizations and main language of my app is Persian.
