如何使用连续顺序方法构建查询



我得到错误与链接顺序方法建立查询,因为它有一个返回类型为void。

final qc =
Entity_.objectID
.equals(objectId)
.and(Entity_.date
.lessOrEqual(date.millisecondsSinceEpoch));
final  QueryBuilder qBuilder = _box
.query(qc)
.order(DualPhaseOilWaterTankReadingData_.readingNumber)
.order(DualPhaseOilWaterTankReadingData_.readingDate).build();

List<Entity> data = qBuilder.find();
qBuilder.close();
return data

您可以使用特殊的Dart语法(级联符号)来链接order方法调用:

final QueryBuilder qBuilder = _box.query(qc)
..order(DualPhaseOilWaterTankReadingData_.readingNumber)
..order(DualPhaseOilWaterTankReadingData_.readingDate);
final query = qBuilder.build();

相关内容

  • 没有找到相关文章