Model class

Template class for encapsulating data.

Constructors

Model({required String id, String? userId, Map<String, dynamic> data = const {}})
Creates a new model.
const
Model.fromJson(Map<String, dynamic> json)
Creates an instance from json.
factory

Properties

data Map<String, dynamic>
Data encapsulated by the model.
final
hashCode int
The hash code for this object.
no setterinherited
id String
Id of the model. Should be unique.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
userId String?
Optionnal: Id of the user who's owner of the data. The id should be unique to each user.
final

Methods

copyWith({String? id, String? userId, Map<String, dynamic>? data}) Model
Copies an instance with the possibility of overriding certain fields.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Converts an instance to json.
toString() String
A string representation of this object.
override

Operators

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

Constants

dataKey → const String
Identifier for the data.
idKey → const String
Identifier for the id.
userIdKey → const String
Identifier for the user id.