Skip to content

LocationQuery

Constrains a BackgroundGeolocation.getLocations query by page size, starting offset, and sort order.

A locations read is a paging operation: fetch a bounded slice of the SDK's SQLite database so a large table can be drained incrementally rather than materialised all at once. Unlike SQLQuery (a time-window query over the log database), the vocabulary here is paging-first.

// Newest 500 records
List page = await BackgroundGeolocation.getLocations(LocationQuery(
  limit: 500,
  order: LocationQuery.ORDER_DESC
));

Members

limit

int? limit

Maximum number of records to return.

Without a limit, every matching record is returned in a single call.

offset

int? offset

Number of records to skip before returning results.

Combine with LocationQuery.limit for offset-based paging. An explicit offset takes precedence over LocationQuery.page.

order

int? order

Sort order for results: SQLQueryOrder.Asc (oldest first) or SQLQueryOrder.Desc (newest first).

Defaults to PersistenceConfig.locationsOrderDirection.

page

int? page

Zero-indexed page number — a convenience over LocationQuery.offset.

Resolves to offset = page * limit, so page 0 is the first page. Requires LocationQuery.limit; without one it has no effect.