handle method

bool handle(
  1. Map<String, dynamic> info
)

Handle the validation, the info variable will contain the following: info'rule' = Validation rule i.e "min". info'data' = Data the user has passed into the validation. info'message' = Overriding message to be displayed for validation (optional).

Implementation

bool handle(Map<String, dynamic> info) {
  if (info.containsKey("message")) {
    String message = info['message'];
    if (message.contains("|")) {
      title = message.split("|").first;
      description = message.split("|").last;
      textFieldMessage = message.split("|").last;
    } else {
      title = "Invalid data";
      description = message;
      textFieldMessage = message;
    }
  }
  return true;
}