FieldValidateResult constructor

FieldValidateResult({
  1. bool success = false,
  2. List<String> errors = const [],
  3. String error = '',
})

Constructor for FieldValidateResult.

If error is provided and not empty, it is added to the errors list automatically.

Implementation

FieldValidateResult({
  this.success = false,
  this.errors = const [],
  this.error = '',
}) {
  if (error.isNotEmpty) {
    errors = [...errors, error];
  }
}