Search code examples
flutterdartarb

Flutter Localization with ARB files


Actually I was using Arb files for localization in that I don't know how to make and access array type value in .arb files with flutter


Solution

  • You can simply define your object as a String separated by some common separator:

      "months": "january:february:march:april:may:june:july:august:september:october:november:december",
      "@months": {
        "description": "months"
      },
    

    Then, split the String into an array:

    String monthsString = AppLocalizations.of(context)!.months;
    List<String> months = monthsString.split(':');