patchModel<T extends Model> method
Future<T>
patchModel<
T extends Model>({ - required String type,
- required String id,
- ModelAttributes? attributes,
- Map<String, ModelRelationship>? relationships,
})
Implementation
Future<T> patchModel<T extends Model>({
required String type,
required String id,
ModelAttributes? attributes,
Map<String, ModelRelationship>? relationships,
}) async {
final response = await patch('$type/$id', {
'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.toMap()}))
});
return response.as<T>();
}