dart.dom.indexed_db


Classes
Cursor
CursorWithValue
Database
IdbFactory
Index
KeyRange
ObjectStore
OpenDBRequest
Request
Transaction
VersionChangeEvent

@ @
Class Cursor extends NativeFieldWrapperClass1

Fields
direction: String
key: Object
primaryKey: Object
source: dynamic
Getters and Setters
direction: String
key: Object
primaryKey: Object
source: dynamic
Constructors
Cursor()
Methods
advance(int count): void
delete(): Future<dynamic>
next(Object key): void
update(dynamic value): Future<dynamic>

Fields

final String direction
final Object key
final Object primaryKey
final dynamic source

Getters and Setters

@ @
String get direction
@ @
Object get key
@ @
Object get primaryKey
@ @
dynamic get source

Constructors

Cursor()

Methods

@ @
void advance(int count)
@
Future<dynamic> delete()
@ @ @
void next(Object key)
@
Future<dynamic> update(dynamic value)

@ @ @
Class CursorWithValue extends Cursor

Fields
value: Object
Getters and Setters
value: Object

Fields

final Object value

Getters and Setters

@ @
Object get value

@ @ @ @ @ @ @
Class Database extends EventTarget

Static Fields
abortEvent: EventStreamProvider
closeEvent: EventStreamProvider
errorEvent: EventStreamProvider
versionChangeEvent: EventStreamProvider
Fields
name: String
objectStoreNames: List
onAbort: Stream
onClose: Stream
onError: Stream
onVersionChange: Stream
version: dynamic
Getters and Setters
name: String
objectStoreNames: List<String>
onAbort: Stream<Event>
onClose: Stream<Event>
onError: Stream<Event>
onVersionChange: Stream<VersionChangeEvent>
version: dynamic
Methods
$dom_addEventListener(String type, EventListener listener, bool useCapture): void
$dom_removeEventListener(String type, EventListener listener, bool useCapture): void
close(): void
createObjectStore(String name, String keyPath, bool autoIncrement): ObjectStore
deleteObjectStore(String name): void
dispatchEvent(Event event): bool
transaction(dynamic storeName_OR_storeNames, String mode): Transaction
transactionList(List<String> storeNames, String mode): Transaction
transactionStore(String storeName, String mode): Transaction
transactionStores(List<String> storeNames, String mode): Transaction

An indexed database object for storing client-side data in web apps.

Static Fields

@ @
static const EventStreamProvider abortEvent
@ @ @
static const EventStreamProvider closeEvent
@ @
static const EventStreamProvider errorEvent
@ @
static const EventStreamProvider versionChangeEvent

Fields

final String name
final List objectStoreNames
final Stream onAbort
final Stream onClose
final Stream onError
final Stream onVersionChange
final dynamic version

Getters and Setters

@ @
String get name
@ @
List<String> get objectStoreNames
@ @
Stream<Event> get onAbort
@ @ @
Stream<Event> get onClose
@ @
Stream<Event> get onError
@ @
Stream<VersionChangeEvent> get onVersionChange
@ @
dynamic get version

Methods

@ @
void $dom_addEventListener(String type, EventListener listener, bool useCapture)
@ @
void $dom_removeEventListener(String type, EventListener listener, bool useCapture)
@ @
void close()
@ @
ObjectStore createObjectStore(String name, String keyPath, bool autoIncrement)
@ @
void deleteObjectStore(String name)
@ @
bool dispatchEvent(Event event)
Transaction transaction(dynamic storeName_OR_storeNames, String mode)
@ @
Transaction transactionList(List<String> storeNames, String mode)
@ @
Transaction transactionStore(String storeName, String mode)
@ @
Transaction transactionStores(List<String> storeNames, String mode)

@ @ @ @ @ @
Class IdbFactory extends NativeFieldWrapperClass1

Static Fields
supported: bool
Fields
supportsDatabaseNames: bool
Getters and Setters
supported: bool
supportsDatabaseNames: bool
Constructors
IdbFactory()
Methods
cmp(Object first, Object second): int
deleteDatabase(String name, onBlocked): Future<IdbFactory>
getDatabaseNames(): Future<List<String>>
open(String name, int version, onUpgradeNeeded, onBlocked): Future<Database>

Static Fields

static final bool supported

Fields

final bool supportsDatabaseNames

Getters and Setters

static bool get supported

Checks to see if Indexed DB is supported on the current platform.

bool get supportsDatabaseNames

Checks to see if getDatabaseNames is supported by the current platform.

Constructors

IdbFactory()

Methods

@ @
int cmp(Object first, Object second)
@
Future<IdbFactory> deleteDatabase(String name, onBlocked)
@ @ @
Future<List<String>> getDatabaseNames()
@
Future<Database> open(String name, int version, onUpgradeNeeded, onBlocked)

@ @
Class Index extends NativeFieldWrapperClass1

Fields
keyPath: dynamic
multiEntry: bool
name: String
objectStore: ObjectStore
unique: bool
Getters and Setters
keyPath: dynamic
multiEntry: bool
name: String
objectStore: ObjectStore
unique: bool
Constructors
Index()
Methods
count(dynamic key_OR_range): Future<int>
get(dynamic key): Future<dynamic>
getKey(dynamic key): Future<dynamic>
openCursor(dynamic key, KeyRange range, String direction, bool autoAdvance): Stream<CursorWithValue>
openKeyCursor(dynamic key, KeyRange range, String direction, bool autoAdvance): Stream<Cursor>

Fields

final dynamic keyPath
final bool multiEntry
final String name
final ObjectStore objectStore
final bool unique

Getters and Setters

@ @
dynamic get keyPath
@ @
bool get multiEntry
@ @
String get name
@ @
ObjectStore get objectStore
@ @
bool get unique

Constructors

Index()

Methods

@
Future<int> count(dynamic key_OR_range)
@
Future<dynamic> get(dynamic key)
@
Future<dynamic> getKey(dynamic key)
Stream<CursorWithValue> openCursor(dynamic key, KeyRange range, String direction, bool autoAdvance)

Creates a stream of cursors over the records in this object store.

See also:

  • ObjectStore.openCursor
Stream<Cursor> openKeyCursor(dynamic key, KeyRange range, String direction, bool autoAdvance)

Creates a stream of cursors over the records in this object store.

See also:

  • ObjectStore.openCursor

@ @
Class KeyRange extends NativeFieldWrapperClass1

Fields
lower: Object
lowerOpen: bool
upper: Object
upperOpen: bool
Getters and Setters
lower: Object
lowerOpen: bool
upper: Object
upperOpen: bool
Constructors
KeyRange.bound(dynamic lower, dynamic upper, bool lowerOpen, bool upperOpen)
KeyRange.lowerBound(dynamic bound, bool open)
KeyRange.only(dynamic value)
KeyRange.upperBound(dynamic bound, bool open)
Methods
bound_(Object lower, Object upper, bool lowerOpen, bool upperOpen): KeyRange
lowerBound_(Object bound, bool open): KeyRange
only_(Object value): KeyRange
upperBound_(Object bound, bool open): KeyRange

Fields

final Object lower
final bool lowerOpen
final Object upper
final bool upperOpen

Getters and Setters

@ @
Object get lower
@ @
bool get lowerOpen
@ @
Object get upper
@ @
bool get upperOpen

Constructors

@
factory KeyRange.bound(dynamic lower, dynamic upper, bool lowerOpen, bool upperOpen)
@
factory KeyRange.lowerBound(dynamic bound, bool open)
@
factory KeyRange.only(dynamic value)
@
factory KeyRange.upperBound(dynamic bound, bool open)

Methods

@ @ @
static KeyRange bound_(Object lower, Object upper, bool lowerOpen, bool upperOpen)
@ @ @
static KeyRange lowerBound_(Object bound, bool open)
@ @ @
static KeyRange only_(Object value)
@ @ @
static KeyRange upperBound_(Object bound, bool open)

@ @
Class ObjectStore extends NativeFieldWrapperClass1

Fields
autoIncrement: bool
indexNames: List
keyPath: dynamic
name: String
transaction: Transaction
Getters and Setters
autoIncrement: bool
indexNames: List<String>
keyPath: dynamic
name: String
transaction: Transaction
Constructors
ObjectStore()
Methods
add(dynamic value, dynamic key): Future<dynamic>
clear(): Future<dynamic>
count(dynamic key_OR_range): Future<int>
createIndex(String name, dynamic keyPath, bool unique, bool multiEntry): Index
delete(dynamic key_OR_keyRange): Future<dynamic>
deleteIndex(String name): void
getObject(dynamic key): Future<dynamic>
index(String name): Index
openCursor(dynamic key, KeyRange range, String direction, bool autoAdvance): Stream<CursorWithValue>
put(dynamic value, dynamic key): Future<dynamic>

Fields

final bool autoIncrement
final List indexNames
final dynamic keyPath
final String name
final Transaction transaction

Getters and Setters

@ @
bool get autoIncrement
@ @
List<String> get indexNames
@ @
dynamic get keyPath
@ @
String get name
@ @
Transaction get transaction

Constructors

ObjectStore()

Methods

@
Future<dynamic> add(dynamic value, dynamic key)
@
Future<dynamic> clear()
@
Future<int> count(dynamic key_OR_range)
@
Index createIndex(String name, dynamic keyPath, bool unique, bool multiEntry)
@
Future<dynamic> delete(dynamic key_OR_keyRange)
@ @
void deleteIndex(String name)
@
Future<dynamic> getObject(dynamic key)
@ @
Index index(String name)
@
Stream<CursorWithValue> openCursor(dynamic key, KeyRange range, String direction, bool autoAdvance)

Creates a stream of cursors over the records in this object store.

The stream must be manually advanced by calling Cursor.next after each item or by specifying autoAdvance to be true.

var cursors = objectStore.openCursor().listen(
  (cursor) {
    // ...some processing with the cursor
    cursor.next(); // advance onto the next cursor.
  },
  onDone: () {
    // called when there are no more cursors.
    print('all done!');
  });
Asynchronous operations which are not related to the current transaction will cause the transaction to automatically be committed-- all processing must be done synchronously unless they are additional async requests to the current transaction.

@
Future<dynamic> put(dynamic value, dynamic key)

@ @ @
Class OpenDBRequest extends Request

Static Fields
blockedEvent: EventStreamProvider
upgradeNeededEvent: EventStreamProvider
Fields
onBlocked: Stream
onUpgradeNeeded: Stream
Getters and Setters
onBlocked: Stream<Event>
onUpgradeNeeded: Stream<VersionChangeEvent>

Static Fields

@ @
static const EventStreamProvider blockedEvent
@ @
static const EventStreamProvider upgradeNeededEvent

Fields

final Stream onBlocked
final Stream onUpgradeNeeded

Getters and Setters

@ @
Stream<Event> get onBlocked
@ @
Stream<VersionChangeEvent> get onUpgradeNeeded

@ @ @
Class Request extends EventTarget

Static Fields
errorEvent: EventStreamProvider
successEvent: EventStreamProvider
Fields
error: DomError
onError: Stream
onSuccess: Stream
readyState: String
result: dynamic
source: dynamic
transaction: Transaction
Getters and Setters
error: DomError
onError: Stream<Event>
onSuccess: Stream<Event>
readyState: String
result: dynamic
source: dynamic
transaction: Transaction
Methods
$dom_addEventListener(String type, EventListener listener, bool useCapture): void
$dom_removeEventListener(String type, EventListener listener, bool useCapture): void
dispatchEvent(Event event): bool

Static Fields

@ @
static const EventStreamProvider errorEvent
@ @
static const EventStreamProvider successEvent

Fields

final DomError error
final Stream onError
final Stream onSuccess
final String readyState
final dynamic result
final dynamic source
final Transaction transaction

Getters and Setters

@ @
DomError get error
@ @
Stream<Event> get onError
@ @
Stream<Event> get onSuccess
@ @
String get readyState
@ @
dynamic get result
@ @
dynamic get source
@ @
Transaction get transaction

Methods

@ @
void $dom_addEventListener(String type, EventListener listener, bool useCapture)
@ @
void $dom_removeEventListener(String type, EventListener listener, bool useCapture)
@ @
bool dispatchEvent(Event event)

@ @
Class Transaction extends EventTarget

Static Fields
abortEvent: EventStreamProvider
completeEvent: EventStreamProvider
errorEvent: EventStreamProvider
Fields
completed: Future
db: Database
error: DomError
mode: String
onAbort: Stream
onComplete: Stream
onError: Stream
Getters and Setters
completed: Future<Database>
db: Database
error: DomError
mode: String
onAbort: Stream<Event>
onComplete: Stream<Event>
onError: Stream<Event>
Methods
$dom_addEventListener(String type, EventListener listener, bool useCapture): void
$dom_removeEventListener(String type, EventListener listener, bool useCapture): void
abort(): void
dispatchEvent(Event event): bool
objectStore(String name): ObjectStore

Static Fields

@ @
static const EventStreamProvider abortEvent
@ @
static const EventStreamProvider completeEvent
@ @
static const EventStreamProvider errorEvent

Fields

final Future completed
final Database db
final DomError error
final String mode
final Stream onAbort
final Stream onComplete
final Stream onError

Getters and Setters

Future<Database> get completed

Provides a Future which will be completed once the transaction has completed.

The future will error if an error occurrs on the transaction or if the transaction is aborted.

@ @
Database get db
@ @
DomError get error
@ @
String get mode
@ @
Stream<Event> get onAbort
@ @
Stream<Event> get onComplete
@ @
Stream<Event> get onError

Methods

@ @
void $dom_addEventListener(String type, EventListener listener, bool useCapture)
@ @
void $dom_removeEventListener(String type, EventListener listener, bool useCapture)
@ @
void abort()
@ @
bool dispatchEvent(Event event)
@ @
ObjectStore objectStore(String name)

@ @ @
Class VersionChangeEvent extends Event

Fields
dataLoss: String
newVersion: dynamic
oldVersion: dynamic
Getters and Setters
dataLoss: String
newVersion: dynamic
oldVersion: dynamic

Fields

final String dataLoss
final dynamic newVersion
final dynamic oldVersion

Getters and Setters

@ @ @
String get dataLoss
@ @
dynamic get newVersion
@ @
dynamic get oldVersion