validasi library
Classes
-
ArrayValidator<
V extends Validator, T> - Responsible for validating arrays/List based on provided validator.
-
CustomRule<
T> -
CustomRule is a class based user defined Custom Rule if the user wish
to have a complex custom rule. The class itself
meant to be extended and thus inheriting it can later be passed on
customFor
method. - DateTransformer
- Transform the value into DateTime object. Based on the pattern provided.
- DateValidator
- Responsible for validating DateTime or formatted String Date Time.
- FieldValidator
-
A wrapper around Validator to capture first error message and return it.
The FieldValidator is suitable to be used on Flutter's
FormField
. The constructor accepts Validator as parameter. -
GenericValidator<
T> - GroupValidator
- GroupValidator allows you to combine couple of validators with Map syntax and grouped them together. Do note, that GroupValidator is not for validating Map, you should use ObjectValidator instead.
- NumberTransformer
- Transform the value into num object.
- NumberValidator
- Responsible for validating num for both double and int also support type conversion from String based on num.tryParse.
-
ObjectValidator<
T extends Map> - Responsible for validating the object based on schema.
-
Result<
T> -
The Result responsible for returning a value with errors
(under
try
method) and the converted value to target type based on runned Validators. - StringTransformer
-
Transform the value into String object.
It uses
toString
method to transform the value. - StringValidator
- Responsible for validating String also support toString conversion.
-
Transformer<
T> - The Transformer class is the base class for all transformers. This class responsible to transform the value to the desired type.
- Validasi
- This class reponsible to group available Validators to a single class.
-
Validator<
T> - The base Validator class that every validators must extends from. This class responsible to tracking rules and performing custom callback.
Enums
- DateUnit
- The Supported Unit of Date.
Typedefs
-
CustomCallback<
T> = FutureOr< bool> Function(T? value, FailFn fail) - CustomCallback for relatively simple in-line custom user-defined rule.
- FailCallback = void Function(String message)
- The FailCallback will throw FieldError exception based on the message.
- FailFn = bool Function(String message)
- The FailFn returns false and accept a message. Allowing the user to set the message according to their needs.
Exceptions / Errors
- FieldError
- FieldError used for stuff related to rules errors.
- ValidasiException
- The base exception used for stuff related to Validasi error.