BackgroundTaskImage class

Background task about product image upload.

Inheritance

Constructors

BackgroundTaskImage.fromJson(Map<String, dynamic> json)

Properties

barcode → String
finalinherited
country → String
finalinherited
croppedPath → String
finalinherited
cropX1 → int
finalinherited
cropX2 → int
finalinherited
cropY1 → int
finalinherited
cropY2 → int
finalinherited
eraserCoordinates → List<double>?
final
fullPath → 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 setterinherited
imageField → String
finalinherited
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
rotationDegrees → int
finalinherited
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
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
getProductChange() → Product
Product change, as a minimal Product.
inherited
getProductImageChange() → ProductImage
Returns a fake value that means: "remove the previous value when merging".
override
getUriProductHelper(LocalDatabase localDatabase) → Future<UriProductHelper>
inherited
getUser() → User
inherited
isDeduplicable() → bool
Returns true only if it's not a "image/OTHER" task.
inherited
mayRunNow() → bool
Returns true if the task may run now.
inherited
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.
override
preExecute(LocalDatabase localDatabase) → Future<void>
Executes the background task: upload, download, update locally. Runs instantly temporary code in order to "fake" the background task.
inherited
putTransientImage(LocalDatabase localDatabase) → Future<void>
inherited
recover(LocalDatabase localDatabase) → Future<void>
Checks that everything is fine and fix things if needed + if possible.
inherited
removeTransientImage(LocalDatabase localDatabase) → void
inherited
toJson() → Map<String, dynamic>
override
toString() → String
A string representation of this object.
inherited
upload(LocalDatabase localDatabase) → Future<void>
Uploads the product image.
override

Operators

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

Static Methods

addTask(String barcode, {required ProductType? productType, required OpenFoodFactsLanguage language, required ImageField imageField, required File croppedFile, required int rotation, required int x1, required int y1, required int x2, required int y2, required List<double> eraserCoordinates, required BuildContext context}) → Future<void>
Adds the background task about uploading a product image.
cropIfNeeded({required String fullPath, required int rotationDegrees, required int cropX1, required int cropY1, required int cropX2, required int cropY2, required bool forceCompression, required List<double>? eraserCoordinates}) → Future<BackgroundCropResult>
Returns the file path of a crop operation.
getCroppedPath(String fullPath) → Future<String>
getDownsizedRect(int cropX1, int cropY1, int cropX2, int cropY2) → Rect
getResizedRect(Rect source, num factor) → Rect
Returns source with all corners multiplied by a factor.
getUpsizedRect(Rect source) → Rect
isPictureBigEnough(num width, num height) → bool
loadUiImage(Uint8List list) → Future<Image>
Returns an image loaded from data.