Isar class abstract

An instance of the Isar Database.

Properties

directory String?
The directory containing the database file or null on the web.
no setter
hashCode int
The hash code for this object.
no setterinherited
isOpen bool
Is the instance open?
no setter
name String
Name of the instance.
final
path String?
The full path of the database file is directory/name.isar and the lock file directory/name.isar.lock.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

clear() Future<void>
Remove all data in this instance and reset the auto increment values.
clearSync() → void
Remove all data in this instance and reset the auto increment values.
close({bool deleteFromDisk = false}) Future<bool>
Releases an Isar instance.
collection<T>() IsarCollection<T>
Get a collection by its type.
copyToFile(String targetPath) Future<void>
Copy a compacted version of the database to the specified file.
getSize({bool includeIndexes = false, bool includeLinks = false}) Future<int>
Returns the size of all the collections in bytes. Not supported on web.
getSizeSync({bool includeIndexes = false, bool includeLinks = false}) int
Returns the size of all collections in bytes. Not supported on web.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
txn<T>(Future<T> callback()) Future<T>
Executes an asynchronous read-only transaction.
txnSync<T>(T callback()) → T
Executes a synchronous read-only transaction.
verify() Future<void>
Verifies the integrity of the database file.
writeTxn<T>(Future<T> callback(), {bool silent = false}) Future<T>
Executes an asynchronous read-write transaction.
writeTxnSync<T>(T callback(), {bool silent = false}) → T
Executes a synchronous read-write transaction.

Operators

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

Static Properties

instanceNames Set<String>
A list of all Isar instances opened in the current isolate.
no setter

Static Methods

addCloseListener(IsarCloseCallback callback) → void
Registers a listener that is called whenever an Isar instance is released.
addOpenListener(IsarOpenCallback callback) → void
Registers a listener that is called whenever an Isar instance is opened.
getInstance([String name = defaultName]) Isar?
Returns an Isar instance opened in the current isolate by its name. If no name is provided, the default instance is returned.
initializeIsarCore({Map<IsarAbi, String> libraries = const {}, bool download = false}) Future<void>
Initialize Isar Core manually. You need to provide Isar Core libraries for every platform your app will run on.
open(List<CollectionSchema> schemas, {required String directory, String name = defaultName, int maxSizeMiB = Isar.defaultMaxSizeMiB, bool relaxedDurability = true, CompactCondition? compactOnLaunch, bool inspector = true}) Future<Isar>
Open a new Isar instance.
openSync(List<CollectionSchema> schemas, {required String directory, String name = defaultName, int maxSizeMiB = Isar.defaultMaxSizeMiB, bool relaxedDurability = true, CompactCondition? compactOnLaunch, bool inspector = true}) Isar
Open a new Isar instance.
removeCloseListener(IsarCloseCallback callback) → void
Removes a previously registered IsarOpenCallback.
removeOpenListener(IsarOpenCallback callback) → void
Removes a previously registered IsarOpenCallback.
splitWords(String input) List<String>
Split a String into words according to Unicode Annex #29. Only words containing at least one alphanumeric character will be included.

Constants

autoIncrement → const Id
Placeholder for an auto-increment id.
defaultMaxSizeMiB → const int
The default max Isar size.
defaultName → const String
The default Isar instance name.
maxId → const Id
Largest valid id.
minId → const Id
Smallest valid id.
version → const String
The version of the Isar library.