validate method

FormResultFree validate(
  1. Map<String, Object?> data
)

Implementation

FormResultFree validate(Map<String, Object?> data) {
  var formResult = FormResultFree(this);

  fields.forEach((String key, DBFieldFree field) {
    var value = ObjectDescovery.descovr(
      data[key],
      field.type,
      def: field.defaultValue,
    );

    final resultFieldValidate = field.validate(value);
    formResult.success &= resultFieldValidate.success;
    formResult.formResult[key] = resultFieldValidate;
  });

  return formResult;
}