getObject method Null safety

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

Implementation

@Operation.get("id")
Future<Response> getObject(@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 willFindObjectWithQuery(_query);

  InstanceType? result = await _query?.fetchOne();

  if (result == null) {
    return didNotFindObject();
  } else {
    return didFindObject(result);
  }
}