getNotifications method
Implementation
Future<List<Notif>> getNotifications() async {
Database db = await (this.database as FutureOr<Database>);
List<Map<String, dynamic>> maps = await db.query('notification', orderBy: "id DESC");
return List.generate(maps.length, (i) {
Notif obj = Notif(maps[i]['title'], maps[i]['content']);
obj.id = maps[i]['id'];
obj.type = maps[i]['type'];
obj.image = maps[i]['image'];
obj.link = maps[i]['link'];
obj.createdAt = maps[i]['createdAt'];
obj.isRead = maps[i]['isRead'] == 1;
return obj;
});
}