convert<T> method
Returns the result of applying the given convert to this JSON object.
Note: The convert function must be synchronous.
Example
final person = json.map(
(json) => Person(
name: json['name'].as(),
age: json['age'].as(),
email: json['email'].as(),
),
);
Implementation
@pragma('vm:prefer-inline')
T convert<T>(T Function(JsonObject) convert) {
if (_assertionsEnabled) {
if (convert is Future<void> Function(JsonObject)) {
throw ArgumentError.value(
convert,
'mapper',
'Mapper function must be synchronous.',
);
}
}
return convert(this);
}