AtCollectionModel<T> class abstract

Annotations
  • @experimental

Constructors

AtCollectionModel()

Properties

collectionName String
collectionName is used to identify collections of same type For example, if Preference is a class that extends AtCollectionModel then collectionName can be "preferences" Defaulted to the name of the dart class in lowercase
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
id String
id uniquely identifies this model.
getter/setter pair
namespace String
namespace is used to persist the collection model Typically namespace is used to identify the app that is used to persist the data.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sharedByAtSign String
getter/setter pair
streams ↔ AtCollectionModelStreamOperationsImpl
getter/setter pair

Methods

delete() Future<bool>
Deletes the object and unshares with every @sign it was shared with previously
fromJson(Map<String, dynamic> jsonObject) → dynamic
Populated state of AtCollectionModel from its JSON representation. class that extends AtCollectionModel has to override this method to populate object's state.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
save({bool autoReshare = true, ObjectLifeCycleOptions? options}) Future<bool>
Saves the json representation of AtCollectionModel to the secondary server of a atSign. save calls toJson method to get the json representation of a AtCollectionModel.
share(List<String> atSigns, {ObjectLifeCycleOptions? options}) Future<bool>
share shares the AtCollectionModel object with the atSigns in atSigns list.
sharedWith() Future<List<String>>
Returns a list of @sign with whom AtCollectionModel object is shared with
toJson() Map<String, dynamic>
toJson method returns JSON representation of the object. The save method invokes this method to get the state which will be persisted to the secondary server.
inherited
toString() String
A string representation of this object.
inherited
unshare({List<String>? atSigns}) Future<bool>
unshare unshares the AtCollectionModel object with the atSigns in atSigns list.

Operators

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

Static Methods

getModel<T extends AtCollectionModel>({required String id, required String namespace, required String collectionName}) Future<T>
Returns an instance of a class extending AtCollectionModel for the given id, namespace and collectionName An instance of AtJsonCollectionModel is returned If a specific factory class for a given collection name is not registered Factory class for a collectionName can be registered using method AtCollectionModel.registerFactories(factories)
getModelsByCollectionName<T extends AtCollectionModel>(String collectionName) Future<List<T>>
Returns list of AtCollectionModels that are created for the collectionName passed Returns an empty list when there are no matches
getModelsSharedBy<T extends AtCollectionModel>(String atSign) Future<List<T>>
Returns list of AtCollectionModels that are shared by the given atSign atSign is an optional argument and if not passed returns all of the AtCollectionModels shared by any atSign Returns an empty list when nothing has been shared
getModelsSharedByAnyAtSign<T extends AtCollectionModel>() Future<List<T>>
Returns list of AtCollectionModels that are shared any atSign Returns an empty list when nothing has been shared
getModelsSharedWith<T extends AtCollectionModel>(String atSign) Future<List<T>>
Returns list of AtCollectionModels that are shared with the given atSign Returns an empty list when nothing has been shared
getModelsSharedWithAnyAtSign<T extends AtCollectionModel>() Future<List<T>>
Returns list of AtCollectionModels that are shared with any atSign Returns an empty list when nothing has been shared
registerFactories(List<AtCollectionModelFactory<AtCollectionModel>> factories) → dynamic
Registers list of AtCollectionModelFactory instances. These factories will be used while creating specific sub classes of AtCollectionModel for a given collection