map To List
Eagerly maps all rows from this KQLiteCursor into a List using mapper.
This is a terminal operation that fully consumes the underlying cursor. The mapper is typically provided by the KQLiteAdapter.mapper implemented by KQLiteTable.
Cursor lifecycle
KQLiteCursor is a single-use iterator.
The cursor is automatically closed once iteration completes (i.e., when KQLiteCursor.hasNext returns
false).After this call, the cursor is considered consumed and closed.
Characteristics
Eager: Entire result set is loaded into memory.
Safe: No manual resource management required.
One-shot: Cannot be re-iterated.
Example (Cursor object mapping)
val empList = Employee.quickSelect().mapToList(Employee::mapper)Return
A list if type T containing mapped elements for all rows.
Author
MOHAMMAD AZIM ANSARI
Parameters
Transforms the current cursor row into T.
See also
Maps each emitted KQLiteCursor from the upstream Flow into a List.
Each cursor emission is fully consumed and closed via KQLiteCursor.mapToList. The mapper is typically provided by the KQLiteAdapter.mapper implemented by KQLiteTable.
Threading
Mapping is executed on Dispatchers.IO by default.
A custom dispatcher can be provided to control threading.
Uses flowOn to shift upstream execution.
Behavior
Each emission results in full traversal + allocation.
Suitable for UI state snapshots or immutable data pipelines.
Safety
No cursor leaks: each cursor is fully consumed and auto-closed.
Example (Cursor mapping as Flow)
val flow = Employee.quickSelect().asCallbackFlow().mapToList(ioDispatcher, Employee::mapper)Return
A flow emitting lists for each cursor emission.
Author
MOHAMMAD AZIM ANSARI
Parameters
Optional CoroutineDispatcher for upstream execution.
Row mapper.