BackgroundTaskRefreshLater class
Background task that triggers a product refresh "a bit later".
Typical use-case is after uploading an image. It takes roughly 10 minutes before Robotoff provides new questions: we should then refresh the product. cf. https://github.com/openfoodfacts/smooth-app/issues/3380
- Inheritance
-
- Object
- BackgroundTask
- BackgroundTaskBarcode
- BackgroundTaskRefreshLater
Constructors
-
BackgroundTaskRefreshLater.fromJson(Map<
String, dynamic> json)
Properties
- barcode → String
-
finalinherited
- country → String
-
finalinherited
- 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 setterinherited
- languageCode → String
-
finalinherited
- processName → String
-
Typically, similar to the name of the class that extends this one.
finalinherited
- productType → ProductType
-
finalinherited
- refreshAfterException → bool
-
Should we refresh the product data after an exception?
no setterinherited
- 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".
finalinherited
- timestamp → int
-
Timestamp when the task was created, in millis.
final
- uniqueId → String
-
Unique task identifier, needed e.g. for task overwriting.
finalinherited
- user → String
-
finalinherited
Methods
-
addToManager(
LocalDatabase localDatabase, {required BackgroundTaskQueue queue, BuildContext? context, bool showSnackBar = true}) → Future< void> -
Adds this task to the BackgroundTaskManager.
inherited
-
execute(
LocalDatabase localDatabase) → Future< void> -
Executes the background task: upload, download, update locally.
inherited
-
getCountry(
) → OpenFoodFactsCountry? -
inherited
-
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
override
-
getLanguage(
) → OpenFoodFactsLanguage -
inherited
-
getUriProductHelper(
LocalDatabase localDatabase) → Future< UriProductHelper> -
inherited
-
getUser(
) → User -
inherited
-
isDeduplicable(
) → bool -
Returns true if tasks with the same stamp would overwrite each-other.
inherited
-
mayRunNow(
) → bool -
Returns true if "enough" time elapsed after the task creation.
override
-
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.
inherited
-
preExecute(
LocalDatabase localDatabase) → Future< void> -
Here we change nothing, therefore we do nothing.
override
-
recover(
LocalDatabase localDatabase) → Future< void> -
Checks that everything is fine and fix things if needed + if possible.
inherited
-
toJson(
) → Map< String, dynamic> -
override
-
toString(
) → String -
A string representation of this object.
inherited
-
upload(
LocalDatabase localDatabase) → Future< void> -
Here we change nothing, therefore we do nothing.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
addTask(
String barcode, {required LocalDatabase localDatabase, required ProductType productType}) → Future< void> - Adds the background task about refreshing the product later.