set method

Future<BagelResponse> set(
  1. Map<String, dynamic> item
)

Set an item in order to determine the id of the item yourself. in the event the itemID already exists, set() will simply update the exising item

Implementation

Future<BagelResponse> set(Map<String, dynamic> item) async {
  if (_item == null) throw ("item id must be set to use the method set");
  String url = '$baseEndpoint/collection/$collectionID/items/$_item?set=true';
  if (nestedCollectionsIDs.isNotEmpty) {
    String nestedID = nestedCollectionsIDs.join(".");
    url = '$url&nestedID=$nestedID';
  }
  Dio dio = await _dio();
  Response res = await dio.put(url, data: item);
  return BagelResponse(data: res.data, statusCode: res.statusCode!);
}