create static method

DataDeliveryPolicy? create({
  1. required DataType dataType,
  2. Duration throttleInterval = Duration.zero,
})

Create a policy for dataType, throttled to throttleInterval.

The data type cannot be changed afterwards. Creation fails for a data type that does not support a delivery policy, which is the case for DataType.camera, DataType.notification, DataType.nmeaChunk and DataType.unknown.

Parameters

  • dataType: The data type this policy applies to. Required.
  • throttleInterval: Minimum time between delivered updates. Duration.zero, or any non-positive duration, means no throttling. A positive duration shorter than one millisecond is raised to one millisecond. Defaults to Duration.zero.

Returns

Implementation

static DataDeliveryPolicy? create({
  required DataType dataType,
  Duration throttleInterval = Duration.zero,
}) {
  final int? id = _create('DataDeliveryPolicy', dataType);
  if (id == null) {
    return null;
  }

  final DataDeliveryPolicy policy = DataDeliveryPolicy.init(id, dataType);
  if (throttleInterval != Duration.zero) {
    policy.throttleInterval = throttleInterval;
  }
  return policy;
}