BackgroundTask class abstract

Abstract background task.

Implementers

Constructors

BackgroundTask({required String processName, required String uniqueId, required String stamp, OpenFoodFactsLanguage? language})
BackgroundTask.fromJson(Map<String, dynamic> json)

Properties

country → String
final
hashCode → int
The hash code for this object.
no setterinherited
hasImmediateNextTask → bool
Returns true if the task ends calling another task for immediate exec.
no setter
languageCode → String
final
processName → String
Typically, similar to the name of the class that extends this one.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
stamp → String
Generic task identifier, like "details:categories for barcode 1234", needed e.g. for task overwriting".
final
uniqueId → String
Unique task identifier, needed e.g. for task overwriting.
final
user → String
final

Methods

addToManager(LocalDatabase localDatabase, {required BackgroundTaskQueue queue, BuildContext? context, bool showSnackBar = true}) → Future<void>
Adds this task to the BackgroundTaskManager.
execute(LocalDatabase localDatabase) → Future<void>
Executes the background task: upload, download, update locally.
getCountry() → OpenFoodFactsCountry?
getFloatingMessage(AppLocalizations appLocalizations) → (String, AlignmentGeometry)?
Floating message when we add the task, like "Added to the task queue!" Also pass an AlignmentGeometry to express where it should be displayed
getLanguage() → OpenFoodFactsLanguage
getUser() → User
isDeduplicable() → bool
Returns true if tasks with the same stamp would overwrite each-other.
mayRunNow() → bool
Returns true if the task may run now.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
postExecute(LocalDatabase localDatabase, bool success) → Future<void>
To be executed after the actual run.
preExecute(LocalDatabase localDatabase) → Future<void>
Executes the background task: upload, download, update locally. Runs instantly temporary code in order to "fake" the background task.
recover(LocalDatabase localDatabase) → Future<void>
Checks that everything is fine and fix things if needed + if possible.
toJson() → Map<String, dynamic>
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

getProcessName(Map<String, dynamic> map) → String