patchModel<T extends Model> method
Future<T>
patchModel<
T extends Model>( - Uri baseUri,
- String type,
- String id, {
- ModelAttributes? attributes,
- Map<String, ModelRelationship>? relationships,
})
Implementation
Future<T> patchModel<T extends Model>(
Uri baseUri,
String type,
String id, {
ModelAttributes? attributes,
Map<String, ModelRelationship>? relationships,
}) async {
final response = await patch(Uri.parse(baseUri.toString() + '$type/$id'), {
'data': {
'type': type,
'id': id,
if (attributes != null) //
'attributes': attributes.toMap()..removeWhere((_, value) => value == null),
if (relationships != null) //
'relationships': relationships.map((key, value) => MapEntry(key, {'data': value.toJson()}))
}
});
return response.as<T>();
}