validateLength method

String? validateLength({
  1. required int stringLength,
})

Implementation

String? validateLength({
  required int stringLength,
}) {
  if (this == null || this!.isEmpty) {
    return "empty_error".translate;
  } else if (this!.length < stringLength) {
    return "length_error".translate
        .replaceAll(
      "%a",
      stringLength.toString(),
    );
  } else {
    return null;
  }
}