put method

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

Build and execute a put request to bagelDB. item should follow the collection schema as defined at app.bageldb.com

Implementation

Future<BagelResponse> put(Map<String, dynamic> item) async {
  if (_item == null) throw ("item id must be set to use the method put");
  String url = '$baseEndpoint/collection/$collectionID/items/$_item';
  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!);
}