heartbeat property Null safety

Duration? heartbeat

The heartbeat interval.

The interval when the Replicator sends the ping message to check whether the other peer is still alive.

Setting this value to Duration.zero or a negative Duration will result in an ArgumentError being thrown.

To use the default of 300 seconds, set this property to null.

Implementation

Duration? get heartbeat => _heartbeat;
void heartbeat=(Duration? heartbeat)

Implementation

set heartbeat(Duration? heartbeat) {
  if (heartbeat != null && heartbeat.inSeconds <= 0) {
    throw ArgumentError.value(
      heartbeat,
      'heartbeat',
      'must not be zero or negative',
    );
  }
  _heartbeat = heartbeat;
}