connectionState property
Stream of connection state changes.
Implementation
@override
Stream<PrinterConnectionState> get connectionState {
_connectionStateStream ??= _connectionChannel
.receiveBroadcastStream()
.map((event) {
final state = event as String;
switch (state) {
case 'connected':
return PrinterConnectionState.connected;
case 'connecting':
return PrinterConnectionState.connecting;
case 'disconnecting':
return PrinterConnectionState.disconnecting;
case 'disconnected':
default:
return PrinterConnectionState.disconnected;
}
});
return _connectionStateStream!;
}