startAfterDocument method

Query<T> startAfterDocument(
  1. DocumentSnapshot<Object?> documentSnapshot
)

Starts the query results after the document.

Parameters:

  • documentSnapshot: The document to start after.

Returns: A new Query starting after the document.

Example:

query = query.startAfterDocument(snapshot);

Implementation

Query<T> startAfterDocument(DocumentSnapshot documentSnapshot) {
  Query<T> newQuery = Query<T>(
    helper: QueryHelper(),
    oracledb: _oracledb,
    path: path,
  );
  _helper.dupQuery(newQuery, this);
  String fieldName = newQuery._explicitOrder[0]["field"];
  final dynamic data = documentSnapshot.data() ?? {};
  final value = data[fieldName];
  newQuery._conditions.add({"field": fieldName, "op": ">", "value": value});
  return newQuery;
}