enum Page { lists, templates } class List { List(this.name, {this.id, this.isTemplate}); int? id; String name; bool? isTemplate; Map toMap() { var map = Map(); if (id != null) map["id"] = this.id; map["list_name"] = this.name; if (isTemplate != null) map["is_template"] = isTemplate! ? 1 : 0; return map; } static List fromMap(Map map) { return List(map["list_name"], id: map["id"], isTemplate: map["is_template"] == 1); } } class Check { Check(this.text, this.value, {this.id, this.listID}); int? id; String text; bool value; int? listID; Map toMap() { var map = Map(); if (id != null) map["id"] = this.id; map["check_text"] = this.text; map["status"] = this.value ? 1 : 0; if (listID != null) map["list_id"] = this.listID! as int; return map; } static Check fromMap(Map map) { return Check(map["check_text"], map["status"] == 1, id: map["id"], listID: map["list_id"]); } }