validateText static method

String validateText(
  1. Object? value, {
  2. bool address = false,
})

Implementation

static String validateText(Object? value, {bool address = false}) {
  if (value is! String ||
      value.length > (address ? 512 : 120) ||
      (!address && value.trim().isEmpty) ||
      RegExp(r'[\x00-\x1f\x7f-\x9f]').hasMatch(value)) {
    throw const FormatException('Invalid or oversized map destination text.');
  }
  return value.trim();
}