fromDynamic static method
Processes the validator object from the given map
which must be an
actual Map or a Map-like object that supports the []
operator. Any
non-null object that is not Map-like will result in an error. A null
value will result in a return value of null
.
This expects the JSON format:
{
"allowNegative": <bool>,
"type": "currency"
}
Implementation
static CurrencyValidator fromDynamic(dynamic map) {
CurrencyValidator result;
if (map == null) {
throw Exception('[CurrencyValidator.fromDynamic]: map is null');
} else {
assert(map['type'] == kType);
result = CurrencyValidator(
allowNegative: map['allowNegative'] == null
? true
: JsonClass.parseBool(map['allowNegative']),
);
}
return result;
}