Isar class abstract

An Isar database instance.

Constructors

Isar()

Properties

directory String
The directory containing the database file.
no setter
hashCode int
The hash code for this object.
no setterinherited
isOpen bool
Whether this instance is open and active.
no setter
name String
Name of the instance.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
schemas List<IsarSchema>
Get the schemas of all collections and embedded objects in this instance.
no setter

Methods

clear() → void
Remove all data in this instance.
close({bool deleteFromDisk = false}) bool
Releases an Isar instance.
collection<ID, OBJ>() IsarCollection<ID, OBJ>
Get a collection by its type.
collectionByIndex<ID, OBJ>(int index) IsarCollection<ID, OBJ>
Get a collection by its index.
copyToFile(String path) → void
Copy a compacted version of the database to the specified file.
getSize({bool includeIndexes = false}) int
Returns the size of all the collections in bytes.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
read<T>(T callback(Isar isar)) → T
Create a synchronous read transaction.
readAsync<T>(T callback(Isar isar), {String? debugName}) Future<T>
Create an asynchronous read transaction.
readAsyncWith<T, P>(P param, T callback(Isar isar, P param), {String? debugName}) Future<T>
Create an asynchronous read transaction and pass a parameter to the callback.
toString() String
A string representation of this object.
inherited
verify() → void
Verifies the integrity of the database. This method is not intended to be used by end users and should only be used by Isar tests. Never call this method on a production database.
write<T>(T callback(Isar isar)) → T
Create a synchronous read-write transaction.
writeAsync<T>(T callback(Isar isar), {String? debugName}) Future<T>
Create an asynchronous read-write transaction.
writeAsyncWith<T, P>(P param, T callback(Isar isar, P param), {String? debugName}) Future<T>
Create an asynchronous read-write transaction and pass a parameter to the callback.

Operators

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

Static Methods

fastHash(String string) int
FNV-1a 64bit hash algorithm optimized for Dart Strings
get({required List<IsarGeneratedSchema> schemas, String name = Isar.defaultName}) Isar
Get an already opened Isar instance by its name.
initialize([String? library]) FutureOr<void>
Initialize Isar manually. This is required if you target web.
open({required List<IsarGeneratedSchema> schemas, required String directory, String name = Isar.defaultName, IsarEngine engine = IsarEngine.isar, int? maxSizeMiB = Isar.defaultMaxSizeMiB, String? encryptionKey, CompactCondition? compactOnLaunch, bool inspector = true}) Isar
Open a new Isar instance.
openAsync({required List<IsarGeneratedSchema> schemas, required String directory, String name = Isar.defaultName, IsarEngine engine = IsarEngine.isar, int? maxSizeMiB = Isar.defaultMaxSizeMiB, String? encryptionKey, CompactCondition? compactOnLaunch, bool inspector = true}) Future<Isar>
Open a new Isar instance asynchronously.

Constants

defaultMaxSizeMiB → const int
The default max Isar size.
defaultName → const String
The default Isar instance name.
sqliteInMemory → const String
Use this value for the directory parameter to create an in-memory database.
version → const String
The current Isar version.