Constructor
Can be many
class Todo {
int _id;
String _title;
String _descrition;
String _date;
int _priority;
Todo(this._title, this._priority, this._date, [this._descrition]);
Todo.withID(this._id, this._title, this._priority, this._date,
[this._descrition]);
}
Getter
int get id => _id;
String get title => _title;
Setter
set title(String newTitle) {
if (newTitle.length <= 255) {
_title = newTitle;
}
}
set descrition(String newDescrition) {
if (newDescrition.length <= 255) {
_descrition = newDescrition;
}
}
Dynamic
Map<String, dynamic> toMap() {
var map = Map<String, dynamic>();
map["title"] = _title;
map["description"] = _descrition;
map["priority"] = _priority;
map["date"] = _date;
if (_id != null) {
map["id"] = _id;
}
return map;
}
from Dynamic
Todo.fromObject(dynamic o){
this._id = o["id"];
this._title = o["title"];
this._descrition = o["description"];
this._priority = o["priority"];
this._date = o["date"];
}
Comentarios
Publicar un comentario