checkIfMonth method Null safety

String? checkIfMonth(
  1. TextEditingController textEditingController
)

Checks if the Value of a TextEditingController is a number within the interval 0, 12.

Implementation

static String? checkIfMonth(TextEditingController textEditingController) {
  final text = textEditingController.text != ""
      ? int.parse(textEditingController.text)
      : 0;
  if (text > 12) {
    return 'Kein valider Monat.';
  }
  // return null if the text is valid
  return null;
}