Constraints class

A specification of the requirements that need to be met before a WorkRequest can run. By default, WorkRequests do not have any requirements and can run immediately. By adding requirements, you can make sure that work only runs in certain situations - for example, when you have an unmetered network and are charging.

Constructors

Constraints({required NetworkType networkType, bool? requiresBatteryNotLow, bool? requiresCharging, bool? requiresDeviceIdle, bool? requiresStorageNotLow})

Properties

hashCode int
The hash code for this object.
no setterinherited
networkType NetworkType
An enumeration of various network types that can be used as Constraints for work.
final
requiresBatteryNotLow bool?
true if the work should only execute when the battery isn't low.
final
requiresCharging bool?
true if the work should only execute while the device is charging.
final
requiresDeviceIdle bool?
true if the work should only execute while the device is idle.
final
requiresStorageNotLow bool?
true if the work should only execute when the storage isn't low.
final
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