Skip to content

Instantly share code, notes, and snippets.

@ericgrandt
Created April 17, 2019 18:50
Show Gist options
  • Save ericgrandt/5a70f4a10130fba98155fd93f03c108c to your computer and use it in GitHub Desktop.
Save ericgrandt/5a70f4a10130fba98155fd93f03c108c to your computer and use it in GitHub Desktop.
class Note {
int id;
String contents;
Note({
this.id,
this.contents,
});
// Create a Note from JSON data
factory Note.fromJson(Map<String, dynamic> json) => new Note(
id: json["id"],
contents: json["contents"],
);
// Convert our Note to JSON to make it easier when we store it in the database
Map<String, dynamic> toJson() => {
"id": id,
"contents": contents,
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment