create method
Creates a new item.
Implementation
Future<M> create({
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,
method: "POST",
body: body,
query: enrichedQuery,
files: files,
headers: headers,
)
.then((data) => itemFactoryFunc(data as Map<String, dynamic>? ?? {}));
}