Model class abstract
Nylo's Model class
Usage
class User extends Model {
String? name;
String? email;
User();
User.fromJson(dynamic data) {
name = data'name'
;
email = data'email'
;
}
toJson() => {
"name": name,
"email": email
};
}
This class can be used to authenticate a model and store the object in storage.
Constructors
- Model()
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
auth(
{String? key}) → Future< void> - Authenticate the model.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
save(
String key, {bool inBackpack = false}) → Future -
Save the object to secure storage using a unique
key
. E.g. User class -
saveToCollection<
T> (String key, {bool inBackpack = false}) → Future - Save an item to a collection E.g. List of numbers
-
toJson(
) → dynamic - Convert the model toJson.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited