fromMap static method
Creates a new instance of this object from a JSON like map.
The map parameter is a JsonMap that contains the properties
of this object.
Implementation
static Script fromMap(JsonMap map) {
final code = map["code"]?.toString().trim() ?? "";
final codeNumeric = map["codeNumeric"]?.toString().trim() ?? "";
if (code.isEmpty && codeNumeric.isEmpty) {
throw ArgumentError(
"The `code` (or at least `codeNumeric`) must be provided!",
);
}
return ScriptCustom(code: code, codeNumeric: codeNumeric).copyWith(
name: map["name"]?.toString(),
date: map["date"]?.toString(),
pva: map["pva"]?.toString(),
);
}