getUserTasks method
Get the entire list of UserTaskSnapshot.
Implementation
Future<List<UserTaskSnapshot>> getUserTasks() async {
List<UserTaskSnapshot> result = [];
try {
final List<Map<String, Object?>> list = await database?.query(
TASK_QUEUE_TABLE_NAME,
columns: [TASK_COLUMN],
) ??
[];
if (list.isNotEmpty) {
for (var element in list) {
final jsonString = element[TASK_COLUMN] as String;
result.add(UserTaskSnapshot.fromJson(
json.decode(jsonString) as Map<String, dynamic>));
}
}
} catch (exception) {
warning('$runtimeType - Failed to load task queue - $exception');
}
return result;
}