registerJobHandler static method

void registerJobHandler(
  1. String key,
  2. JobHandler handler
)

Registers a JobHandler for a specific jobKey.

When a job with this key is processed from the queue, the provided handler will be executed. This should be called within the AppInitializationCallback.

// In your AppInitializationCallback:
GenericBackgroundService.registerJobHandler('syncUserData', _handleUserSync);
GenericBackgroundService.registerJobHandler('processImage', _handleImageProcessing);

Implementation

static void registerJobHandler(String key, JobHandler handler) {
  _jobHandlers[key] = handler;
  debugPrint('BackgroundService: Registered job handler for key "$key"');
}