fromJSON method
Fetches the value of the column from the JSON.
Throws an exception if the column is not found in the JSON.
Implementation
T fromJSON(Map<String, dynamic> json) {
if (!json.containsKey(name)) throw SupaException.missingColumn(name);
if (valueFromJSON != null) return valueFromJSON!(json[name] as J);
if (T == BigInt || T == _Nullable<BigInt>) {
return _fromSpecificType(
json[name],
(value) => BigInt.from(value as int),
);
}
if (T == DateTime || T == _Nullable<DateTime>) {
return _fromSpecificType(
json[name],
(value) => DateTime.parse(value as String),
);
}
return json[name] as T;
}