readIndex method

List<List<Object?>> readIndex(
  1. String indexName
)

Read every entry of the named index. Each returned record is the list of key-column values followed by the integer rowid (as SQLite stores it). Entries are returned in B-tree order, which for a well-formed index is ascending key order.

Implementation

List<List<Object?>> readIndex(String indexName) {
  SqliteSchemaRow? schema;
  for (final s in readSchema()) {
    if (s.type == 'index' && s.name == indexName) {
      schema = s;
      break;
    }
  }
  if (schema == null) {
    throw StateError('No such index: $indexName');
  }
  return _walkIndexBTree(schema.rootPage).toList();
}