In my code, which is presented below, I convert my group into a database model and add it to the database. Then I return the group object. and I need to return a list of groups that are added to the database. How can I create a method that returns a list of groups from those that are added to the database?
class GroupRepository extends BaseRepository<GroupDao, GroupDBData, Group> {
@override
GroupDao dao = injector<AppDb>().groupDao;
@override
BaseConverter<GroupDBData, Group> converter = GroupDbConverter();
Future<Group> convertGroup(Group group) async {
final convert = converter.outToIn(group);
final groupId = await dao.insert(convert);
Group groupWithID = Group(
id: groupId,
groupName: group.groupName,
);
return groupWithID;
}
}
Inside
Daowrite Query to fetch groups, like below