deleteObject method Null safety

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

Implementation

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

  _query = await willDeleteObjectWithQuery(_query);

  final result = await _query?.delete();

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