deleteObject method Null safety

  1. @Operation("id")
Future<Response> deleteObject(
  1. @Bind("id") String id
)
@Operation("id")

Implementation

@Operation.delete("id")
Future<Response> deleteObject(@Bind.path("id") String id) async {
  var primaryKey = _query!.entity.primaryKey;
  final parsedIdentifier =
      _getIdentifierFromPath(id, _query!.entity.properties[primaryKey]);
  _query!.where((o) => o[primaryKey]).equalTo(parsedIdentifier);

  _query = await willDeleteObjectWithQuery(_query);

  var result = await _query?.delete();

  if (result == 0) {
    return didNotFindObjectToDeleteWithID(id);
  } else {
    return didDeleteObjectWithID(id);
  }
}