addNoteInDB method
- NotesModel newNote
Adds note in database
Implementation
Future<NotesModel> addNoteInDB(NotesModel newNote) async {
final db = await database;
int id = await db.transaction((transaction) {
return transaction.rawInsert(
'INSERT into Notes(content, date) VALUES ( "${newNote.content}", "${newNote.date.toIso8601String()}");');
});
newNote.id = id;
print('Note added: ${newNote.content}');
return newNote;
}