none constant

Constraints const none

No constraints - task can run anytime.

Use this for tasks that should run as soon as possible regardless of network, battery, or charging state. Be cautious as this can impact battery life and use cellular data.

Equivalent to: Constraints()

When to use:

  • Critical user-initiated actions
  • Time-sensitive operations
  • Emergency tasks
  • Local-only operations (no network needed)

When NOT to use:

  • Network-dependent tasks → Use networkRequired
  • Large uploads/downloads → Use heavyTask
  • Background maintenance → Use custom constraints
// Critical local operation - run immediately
await NativeWorkManager.enqueue(
  taskId: 'emergency-save',
  trigger: TaskTrigger.oneTime(),
  worker: DartWorker(callbackId: 'saveToLocalDb'),
  constraints: Constraints.none,
);

Implementation

static const Constraints none = Constraints();