diff --git a/lib/services/database.dart b/lib/services/database.dart index 4280310..dbc7628 100644 --- a/lib/services/database.dart +++ b/lib/services/database.dart @@ -60,10 +60,8 @@ class NotesDatabaseService { Future addNoteInDB(NotesModel newNote) async { final db = await database; if (newNote.title.trim().isEmpty) newNote.title = 'Untitled Note'; - int id = await db.transaction((transaction) { - transaction.rawInsert( - 'INSERT into Notes(title, content, date, isImportant) VALUES ("${newNote.title}", "${newNote.content}", "${newNote.date.toIso8601String()}", ${newNote.isImportant == true ? 1 : 0});'); - }); + int id = await db.transaction((transaction) => transaction.rawInsert( + 'INSERT into Notes(title, content, date, isImportant) VALUES ("${newNote.title}", "${newNote.content}", "${newNote.date.toIso8601String()}", ${newNote.isImportant == true ? 1 : 0});')); newNote.id = id; print('Note added: ${newNote.title} ${newNote.content}'); return newNote;