DbModel class abstract

Represents a class can be saved in the database.

Every DbModel has by default some fields.

id - serverId - creationTime - modificationTime

Constructors

DbModel()
Create an instance of DbModel.

Properties

creationTime DateTimeField
The creation time of this model, its value set once automatically when created in db.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
id IdField
The Id column of this model.
getter/setter pair
modificationTime DateTimeField
The modification time of this model, its value set automatically when created or modified in db.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
serverId IntField
The server id column of this model.
getter/setter pair

Methods

afterDelete() → dynamic
Called automatically after this model be deleted from db.
afterLoad() → dynamic
afterSave(bool isNew) → dynamic
Called automatically after this model be saved in db.
beforeDelete() → dynamic
Called automatically before this model deletion from db. For example if a student has multiple exam marks, all marks should be deleted before delete this model.
beforeSave(bool isNew) → dynamic
Called automatically before this model saving in db.
copyValuesFrom(DbModel other, {List<FieldWithValue>? fieldsToCopy, bool fullCopy = false}) → void
Copy values from other db model fields to this fields.
differ(DbModel other, {List<FieldWithValue>? fieldsToCheck, bool allFields = true}) bool
Check weather there are different in some fields values.
differIn(DbModel other, {List<FieldWithValue>? fieldsToCheck, bool? allFields = true}) Iterable<FieldWithValue>
Get the fields that has different values.
fromMap(Map<String, dynamic> m) → void
Set values of this model from json map.
getAllFields() List<FieldWithValue?>
Get a list of all fields of this model with pre-created fields.
getFields() List<FieldWithValue>?
Get a list of the new defined fields of this model without pre-created fields.
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.
inherited