NSDatabase class
Dart wrapper around a process-shared ns_database_t handle.
Multiple isolates can call NSDatabase.open with the same path; the
native registry returns the same pointer. Call close once per open.
When encryptionKey is provided, entity and index data are encrypted at
rest with AES-256-GCM. The key material is hashed with SHA-256 to produce
the AES key. Encrypted databases must be reopened with the same key.
Each isolate that opens an encrypted database supplies fresh encrypt/decrypt
callbacks on acquire; they are bound to that isolate's thread.
Constructors
-
NSDatabase.fromPointer(Pointer<
ns_database_t> db, {String path = ''}) - NSDatabase.open(String path, {String? encryptionKey})
Properties
-
changes
→ Stream<
NSDatabaseChange> -
Committed changes across the whole database.
no setter
-
handle
→ Pointer<
ns_database_t> -
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
no setter
Methods
-
beginTransaction(
) → NSTransaction - Begin a new transaction on this database.
-
close(
) → void -
delete(
NSKey key) → bool -
Remove a committed entity by
key. Returns false if not found. -
get(
NSKey key) → NSEntity? -
Read a committed entity by
key. Returns null if not found. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
put(
NSEntity entity) → void -
query(
String tableName, {List< String> ? orderBy}) → NSQuery -
Start building a query against
tableName. -
toString(
) → String -
A string representation of this object.
inherited
-
watchQuery(
NSQuery query) → Stream< NSDatabaseChange> -
Committed changes limited to entities matching
query. -
wipe(
) → void
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited