getObject method Null safety

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

Implementation

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

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

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