IDBKeyRange class

The interface of the IndexedDB API represents a continuous interval over some data type that is used for keys. Records can be retrieved from IDBObjectStore and IDBIndex objects using keys or a range of keys. You can limit the range using lower and upper bounds. For example, you can iterate over all values of a key in the value range A–Z. A key range can be a single value or a range with upper and lower bounds or endpoints. If the key range has both upper and lower bounds, then it is bounded; if it has no bounds, it is unbounded. A bounded key range can either be open (the endpoints are excluded) or closed (the endpoints are included). To retrieve all keys within a certain range, you can use the following code constructs:

Range Code

All keys ≥ x (x)

All keys > x (x, true)

All keys ≤ y (y)

All keys < y (y, true)

All keys ≥ x && ≤ y (x, y)

All keys > x &&< y (x, y, true, true)

All keys > x && ≤ y (x, y, true, false)

All keys ≥ x &&< y (x, y, false, true)

The key = z (z)

A key is in a key range if the following conditions are true:

The lower value of the key range is one of the following:

void Less than key value Equal to key value if lowerOpen is false.

The upper value of the key range is one of the following:

void Greater than key value Equal to key value if upperOpen is false.

Note: This feature is available in Web Workers

Available extensions
Annotations
  • @JS()
  • @staticInterop

Constructors

IDBKeyRange()
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

bound(dynamic lower, dynamic upper, [bool? lowerOpen = false, bool? upperOpen = false]) IDBKeyRange
lowerBound(dynamic lower, [bool? open = false]) IDBKeyRange
only(dynamic value) IDBKeyRange
upperBound(dynamic upper, [bool? open = false]) IDBKeyRange