getError method

String? getError(
  1. String name
)

Implementation

String? getError(String name) {
  if (errors.containsKey(name)) {
    dynamic error = errors[name];

    if (error is List && error.isNotEmpty) {
      String errorText = error[0].toString();
      if (consumeError) {
        remainingError.remove(name);
      }
      return errorText;
    } else {
      String errorText = error.toString();
      if (consumeError) {
        remainingError.remove(name);
      }
      return errorText;
    }
  }
  return null;
}