init method Null safety

void init(
  1. {required Locale defaultLocale,
  2. List<Locale>? otherLocales}
)

Initialize Localization (i18n) implementation

Implementation

static void init(
    {required Locale defaultLocale, List<Locale>? otherLocales}) {
  List<Locale> supportedLocales = [];
  supportedLocales.add(defaultLocale);
  if (otherLocales != null && otherLocales.length > 0)
    supportedLocales.addAll(otherLocales);
  TGLocale.supportedLocales = supportedLocales;
  TGLocale.defaultLocale = defaultLocale;
  TGLocale.currentLocale = defaultLocale;
  loadLocales();
}