getMonth static method

String getMonth(
  1. int num
)

Returns the name of the month corresponding to the given integer.

@param num The integer representing the month (0 for January, 1 for February, etc.). @return The name of the month as a string, or an empty string if the input is out of range.

Implementation

static String getMonth(int num) {
  var month = "";
  var dateFormatSymbols = DateFormat().dateSymbols.STANDALONEMONTHS;
  var months = dateFormatSymbols;
  if (num <= 11) {
    month = months[num];
  }
  return month;
}