getMonthName function

String getMonthName(
  1. int month, {
  2. List<String>? monthNames,
})

Gets the name of the given month by its number, using either the supplied or default name.

Implementation

String getMonthName(int month, {List<String>? monthNames}) {
  final List<String> names = monthNames ??
      <String>[
        'Jan',
        'Feb',
        'Mar',
        'Apr',
        'May',
        'Jun',
        'Jul',
        'Aug',
        'Sep',
        'Oct',
        'Nov',
        'Dec',
      ];
  return names[month - 1];
}