update method
Updates an single item by its id.
Implementation
Future<M> update(
String id, {
Map<String, dynamic> body = const {},
Map<String, dynamic> query = const {},
List<http.MultipartFile> files = const [],
Map<String, String> headers = const {},
String? expand,
String? fields,
}) {
final enrichedQuery = Map<String, dynamic>.of(query);
enrichedQuery["expand"] ??= expand;
enrichedQuery["fields"] ??= fields;
return client
.send(
"$baseCrudPath/${Uri.encodeComponent(id)}",
method: "PATCH",
body: body,
query: enrichedQuery,
files: files,
headers: headers,
)
.then((data) => itemFactoryFunc(data as Map<String, dynamic>? ?? {}));
}