getLocaleWeeks static method

List<String>? getLocaleWeeks(
  1. DateTimePickerLocale locale, [
  2. bool isFull = true
])

Get locale week array

Implementation

static List<String>? getLocaleWeeks(DateTimePickerLocale locale,
    [bool isFull = true]) {
  _StringsI18n i18n = datePickerI18n[locale] ??
      datePickerI18n[DATETIME_PICKER_LOCALE_DEFAULT]!;
  if (isFull) {
    List<String> weeks = i18n.getWeeksFull();
    return weeks;
  }

  List<String>? weeks = i18n.getWeeksShort();
  if (weeks != null && weeks.isNotEmpty) {
    return weeks;
  }

  List<String> fullWeeks = i18n.getWeeksFull();
  return fullWeeks
      .map((item) => item.substring(0, min(3, item.length)))
      .toList();
}