-
-
Save ericgrandt/5a70f4a10130fba98155fd93f03c108c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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