我得到错误与链接顺序方法建立查询,因为它有一个返回类型为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();