aggregate<TValue extends AsyncAggregateValue> method

TValue aggregate<TValue extends AsyncAggregateValue>(
  1. ModelAggregateQuery<TValue> query
)

Get the number of elements in all collections existing in the database.

AsyncAggregateValue is returned, wait a moment and then retrieve the value from AsyncAggregateValue.value.

Values loaded with load are normally retained, but will be reloaded when reload is executed.

データベース上に存在するすべてのコレクションの要素数を取得します。

AsyncAggregateValueが返されるので少し待ったあとAsyncAggregateValue.valueから値を取得してください。

loadで読み込んだ値は通常は保持されますが、reloadを実行した場合は再度読み込まれます。

Implementation

TValue aggregate<TValue extends AsyncAggregateValue>(
    ModelAggregateQuery<TValue> query) {
  if (_aggregate.containsKey(query)) {
    final val = _aggregate[query];
    if (val is TValue) {
      return val;
    }
  }
  final val = query.onCreate(query, this, notifyListeners);
  _aggregate[query] = val;
  return val;
}