YustDocSetup<T extends YustDoc> class

The setup for a YustDoc is needed to read or save a document to the database.

Constructors

YustDocSetup({required String collectionName, required T fromJson(Map<String, dynamic> json), required T newDoc(), String? envId, String? userId, bool hasAuthor = false, bool hasOwner = false, bool forEnvironment = false, bool isEnvironment = false, void onInit(T doc)?, Future<void> onSave(T doc)?, bool removeNullValues = true, bool trackModification = true})

Properties

collectionName String
The name for the document collection.
getter/setter pair
envId String?
The ID of the tenant to use.
getter/setter pair
forEnvironment bool
If true the YustDoc will be automatically saved in a subcollection under the tannant.
getter/setter pair
fromJson ↔ T Function(Map<String, dynamic> json)
Callback to create a document out of a JSON map.
getter/setter pair
hasAuthor bool
If true the createdBy & modifiedBy of the YustDoc will be automatically set when saving.
getter/setter pair
hashCode int
The hash code for this object.
no setteroverride
hasOwner bool
If true the userId of the YustDoc will be automatically set when saving.
getter/setter pair
isEnvironment bool
Should be set to true if this setup is used for an environment.
getter/setter pair
newDoc ↔ T Function()
Callback to create a new document instance.
getter/setter pair
onInit ↔ (void Function(T doc)?)
Callback when initialising a new YustDoc.
getter/setter pair
onSave ↔ (Future<void> Function(T doc)?)
Callback when saving a YustDoc.
getter/setter pair
removeNullValues bool
Should null values be removed, before writing the doc to the database.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
trackModification bool
Should the database actions update the record specified by hasAuthor & hasOwner. Can be overriden in the db-calls directly e.g. saveDoc.
getter/setter pair
userId String?
The id of the YustUser authoring this database action
getter/setter pair

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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