BloomBackground class
Manages background task execution and background periodic synchronization.
Integrates with native platform task schedulers (WorkManager on Android, BGTaskScheduler on iOS) to run background sync, cache invalidation, and data prefetching.
Example:
BloomBackground.registerTask('syncData', (data) async {
return await syncLatestUpdates();
});
await BloomBackground.schedulePeriodicTask(
taskId: 'syncData',
frequency: const Duration(hours: 1),
requiresNetwork: true,
);
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
cancelTask(
String taskId) → Future< void> -
Cancels a scheduled background task by
taskId. -
executeTask(
String taskId, [Map< String, dynamic> data = const {}]) → Future<bool> -
Executes a registered background task handler directly by
taskIdwith optionaldata. -
registerTask(
String taskId, BackgroundTaskCallback callback) → void -
Registers a named background task
callbackhandler matchingtaskId. -
schedulePeriodicTask(
{required String taskId, required Duration frequency, Map< String, dynamic> data = const {}, bool requiresCharging = false, bool requiresNetwork = true}) → Future<bool> - Schedules a periodic background task with native OS task schedulers.