addTask static method
- required String barcode,
- required String insightId,
- required InsightAnnotation insightAnnotation,
- required BuildContext context,
Adds the background task about hunger games.
Implementation
static Future<void> addTask({
required String barcode,
required String insightId,
required InsightAnnotation insightAnnotation,
required BuildContext context,
}) async {
final LocalDatabase localDatabase = context.read<LocalDatabase>();
final String uniqueId = await _operationType.getNewKey(
localDatabase,
barcode: barcode,
);
final BackgroundTaskBarcode task = _getNewTask(
barcode,
insightId,
insightAnnotation.value,
uniqueId,
);
if (!context.mounted) {
return;
}
await task.addToManager(
localDatabase,
context: context,
queue: BackgroundTaskQueue.fast,
);
}