postModel<T extends Model> method
Future<T>
postModel<
T extends Model>({ - required String type,
- ModelAttributes? attributes,
- Map<String, ModelRelationship>? relationships,
})
Implementation
Future<T> postModel<T extends Model>({
required String type,
ModelAttributes? attributes,
Map<String, ModelRelationship>? relationships,
}) async {
final response = await post(type, {
'type': type,
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>();
}