janim2 / RentersParadise

0 stars 0 forks source link

Properties model #4

Closed king-kloy closed 3 years ago

king-kloy commented 3 years ago

Create a model class for Properties model based on the database table.

Eg: a cat model

class Cat {
  String id;
  int name;

  Cat(this.id, this.name);

  // converts cat  details to a Map
  Map<String, dynamic> toMap() {
    var map = <String, dynamic>{
      'id': id,
      'name': name
    };

    return map;
  }

  // destruct map of cat
  Cat.fromMap(Map<String, dynamic> map) {
    id = map['id'];
    name = map['name'];
  }
}

This can be a guide to do it

king-kloy commented 3 years ago

Please deadline is tomorrow by this time. No excuses