import 'dart:collection'; import 'customer_property.dart'; class Customer { String name; String email; String firstname; String sex; int age; String active; int customerId; String password; int birthYear; //int weight; String goal; String fitnessLevel; String bodyType; int admin; int trainer; int dataPolicyAllowed; String firebaseUid; LinkedHashMap properties = LinkedHashMap(); Customer({ this.customerId, this.name, this.firstname, this.email, this.sex, this.age, this.active, this.password, this.birthYear, this.bodyType, this.fitnessLevel, this.goal, //this.weight, this.admin, this.trainer, this.dataPolicyAllowed, this.firebaseUid, }); Customer.fromJson(Map json) { this.customerId = json['customerId']; this.name = json['name']; this.firstname = json['firstname']; this.email = json['email']; this.sex = json['sex']; this.age = json['age']; this.active = json['active']; this.birthYear = json['birthYear']; this.bodyType = json['bodyType']; this.fitnessLevel = json['fitnessLevel']; this.goal = json['goal']; //this.weight = json['weight']; this.admin = json['admin']; this.trainer = json['trainer']; this.firebaseUid = json['firebaseUid']; } Map toJson() => { "name": name, "firstname": firstname, "email": email, "age": age, "sex": sex, "active": 'Y', "password": password, "birthYear": birthYear, "bodyType": bodyType, "fitnessLevel": fitnessLevel, "goal": goal, //"weight": weight, "admin": admin, "trainer": trainer, "dataPolicyAllowed": dataPolicyAllowed, }; double getProperty(String propertyName) { if (this.properties[propertyName] == null) { return 0; } else { return this.properties[propertyName].propertyValue; } } setProperty(String propertyName, double value) { this.properties[propertyName].propertyValue = value; } }