getConnectionState method

  1. @override
Future<ConnectionState> getConnectionState(
  1. BluetoothPrinter printer
)
override

Returns the current connection state for printer.

Implementation

@override
Future<ConnectionState> getConnectionState(BluetoothPrinter printer) async {
  final index = await methodChannel.invokeMethod<int>(
    'getConnectionState',
    <String, Object?>{'printerId': printer.id},
  );
  return ConnectionState.values[(index ?? 0).clamp(
    0,
    ConnectionState.values.length - 1,
  )];
}