IsarCollection<OBJ> class
abstract
Use IsarCollection
instances to find, query, and create new objects of a
given type in Isar.
You can get an instance of IsarCollection
by calling isar.get<OBJ>()
or
by using the generated isar.yourCollections
getter.
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isar → Isar
-
The corresponding Isar instance.
no setter
- name → String
-
The name of the collection.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
schema
→ CollectionSchema<
OBJ> -
Get the schema of the collection.
no setter
Methods
-
buildQuery<
R> ({List< WhereClause> whereClauses = const [], bool whereDistinct = false, Sort whereSort = Sort.asc, FilterOperation? filter, List<SortProperty> sortBy = const [], List<DistinctProperty> distinctBy = const [], int? offset, int? limit, String? property}) → Query<R> - Build a query dynamically for example to build a custom query language.
-
clear(
) → Future< void> - Remove all data in this collection and reset the auto increment value.
-
clearSync(
) → void - Remove all data in this collection and reset the auto increment value.
-
count(
) → Future< int> - Returns the total number of objects in this collection.
-
countSync(
) → int - Returns the total number of objects in this collection.
-
delete(
Id id) → Future< bool> -
Delete a single object by its
id
. -
deleteAll(
List< Id> ids) → Future<int> -
Delete a list of objects by their
ids
. -
deleteAllByIndex(
String indexName, List< IndexKey> keys) → Future<int> -
Delete a list of objects by the unique index
indexName
andkeys
. -
deleteAllByIndexSync(
String indexName, List< IndexKey> keys) → int -
Delete a list of objects by the unique index
indexName
andkeys
. -
deleteAllSync(
List< Id> ids) → int -
Delete a list of objects by their
ids
. -
deleteByIndex(
String indexName, IndexKey key) → Future< bool> -
Delete a single object by the unique index
indexName
andkey
. -
deleteByIndexSync(
String indexName, IndexKey key) → bool -
Delete a single object by the unique index
indexName
andkey
. -
deleteSync(
Id id) → bool -
Delete a single object by its
id
. -
filter(
) → QueryBuilder< OBJ, OBJ, QFilterCondition> - Start building a query using the QueryBuilder.
-
get(
Id id) → Future< OBJ?> -
Get a single object by its
id
ornull
if the object does not exist. -
getAll(
List< Id> ids) → Future<List< OBJ?> > -
Get a list of objects by their
ids
ornull
if an object does not exist. -
getAllByIndex(
String indexName, List< IndexKey> keys) → Future<List< OBJ?> > -
Get a list of objects by the unique index
indexName
andkeys
. -
getAllByIndexSync(
String indexName, List< IndexKey> keys) → List<OBJ?> -
Get a list of objects by the unique index
indexName
andkeys
. -
getAllSync(
List< Id> ids) → List<OBJ?> -
Get a list of objects by their
ids
ornull
if an object does not exist. -
getByIndex(
String indexName, IndexKey key) → Future< OBJ?> -
Get a single object by the unique index
indexName
andkey
. -
getByIndexSync(
String indexName, IndexKey key) → OBJ? -
Get a single object by the unique index
indexName
andkey
. -
getSize(
{bool includeIndexes = false, bool includeLinks = false}) → Future< int> - Returns the size of the collection in bytes. Not supported on web.
-
getSizeSync(
{bool includeIndexes = false, bool includeLinks = false}) → int - Returns the size of the collection in bytes. Not supported on web.
-
getSync(
Id id) → OBJ? -
Get a single object by its
id
ornull
if the object does not exist. -
importJson(
List< Map< json) → Future<String, dynamic> >void> - Import a list of json objects.
-
importJsonRaw(
Uint8List jsonBytes) → Future< void> - Import a list of json objects encoded as a byte array.
-
importJsonRawSync(
Uint8List jsonBytes) → void - Import a list of json objects encoded as a byte array.
-
importJsonSync(
List< Map< json) → voidString, dynamic> > - Import a list of json objects.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
put(
OBJ object) → Future< Id> -
Insert or update an
object
. Returns the id of the new or updated object. -
putAll(
List< OBJ> objects) → Future<List< Id> > -
Insert or update a list of
objects
. Returns the list of ids of the new or updated objects. -
putAllByIndex(
String indexName, List< OBJ> objects) → Future<List< Id> > -
Insert or update a list of
objects
by the unique indexindexName
. Returns the list of ids of the new or updated objects. -
putAllByIndexSync(
String indexName, List< OBJ> objects, {bool saveLinks = true}) → List<Id> -
Insert or update a list of
objects
by the unique indexindexName
. Returns the list of ids of the new or updated objects. -
putAllSync(
List< OBJ> objects, {bool saveLinks = true}) → List<Id> -
Insert or update a list of
objects
. Returns the list of ids of the new or updated objects. -
putByIndex(
String indexName, OBJ object) → Future< Id> -
Insert or update the
object
by the unique indexindexName
. Returns the id of the new or updated object. -
putByIndexSync(
String indexName, OBJ object, {bool saveLinks = true}) → Id -
Insert or update the
object
by the unique indexindexName
. Returns the id of the new or updated object. -
putSync(
OBJ object, {bool saveLinks = true}) → Id -
Insert or update an
object
. Returns the id of the new or updated object. -
toString(
) → String -
A string representation of this object.
inherited
-
verify(
List< OBJ> objects) → Future<void> - Verifies the integrity of the collection and its indexes.
-
verifyLink(
String linkName, List< int> sourceIds, List<int> targetIds) → Future<void> - Verifies the integrity of a link.
-
watchLazy(
{bool fireImmediately = false}) → Stream< void> - Watch the collection for changes.
-
watchObject(
Id id, {bool fireImmediately = false}) → Stream< OBJ?> -
Watch the object with
id
for changes. If a change occurs, the new object will be returned in the stream. -
watchObjectLazy(
Id id, {bool fireImmediately = false}) → Stream< void> -
Watch the object with
id
for changes. -
where(
{bool distinct = false, Sort sort = Sort.asc}) → QueryBuilder< OBJ, OBJ, QWhere> - Start building a query using the QueryBuilder.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited