Mv class

// MAP VALIDATOR
// It is used to validate the data of a Map<String, dynamic>

// All input is required
Mv input = await Mv.validate(map, 'required.all');

// All input is required except phone and address
Mv input = await Mv.validate(map, 'required.all|phone,address');

// Set rule to specific input
Mv input = await Mv.validate(map, {
  'name': 'required',
  'email': 'required|email',
  'phone': 'required|numeric|min:10|max:15',
});

// check result
bool ok = input.ok;
String? error = input.error;
Map<String, dynamic> result = input.result; // details

Constructors

Mv({bool ok = false, String? error, Map result = const {}})

Properties

error String?
final
hashCode int
The hash code for this object.
no setterinherited
ok bool
final
result Map
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

validate(Map<String, dynamic> request, dynamic rule) Future<Mv>