Skip to content

Instantly share code, notes, and snippets.

@aniekan12
Created October 18, 2021 13:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aniekan12/5ba4ff4fe0a402f7f6c5138d7bee331a to your computer and use it in GitHub Desktop.
Save aniekan12/5ba4ff4fe0a402f7f6c5138d7bee331a to your computer and use it in GitHub Desktop.
//the fields we will use to create the table columns in our database
class DemandFields {
static final List<String> values = [
id,
propertyId
];
static final String id = 'id';
static final String propertyId = 'property_id';
}
class DemandNoticeModel {
final int id;
final String propertyId;
const DemandNoticeModel({
this.id,
this.propertyId,
});
DemandNoticeModel copy({
int id,
String propertyId,
}) =>
DemandNoticeModel(
id: id ?? this.id,
propertyId: propertyId ?? this.propertyId,
);
static DemandNoticeModel fromJson(Map<String, Object> json) =>
DemandNoticeModel(
id: json[DemandFields.id] as int,
propertyId: json[DemandFields.propertyId] as String,
);
Map<String, Object> toJson() => {
DemandFields.id: id,
DemandFields.propertyId: propertyId,
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment