mode property

NetworkMode get mode

The current mode.

Implementation

NetworkMode get mode => _mode;
set mode (NetworkMode value)

Sets the mode. Entering or leaving offline is reported on online synchronously, before this returns: a write sent on the next line must find the outbox already knowing the network is gone, or it fails as an uncertain outcome instead of queuing.

A change requested from inside a listener is not lost and does not interrupt the dispatch in progress: it is applied, and reported, once that dispatch has finished. A listener that throws is reported to its zone like any stream listener's error and does not stop the others.

Implementation

set mode(NetworkMode value) {
  _change(() {
    final wasOnline = isOnline;
    _mode = value;
    _announce(wasOnline);
  });
}