getPrinters method

Future<void> getPrinters({
  1. List<ConnectionType> connectionTypes = const [ConnectionType.BLE, ConnectionType.USB],
  2. bool androidUsesFineLocation = false,
})

Implementation

Future<void> getPrinters({
  List<ConnectionType> connectionTypes = const [
    ConnectionType.BLE,
    ConnectionType.USB,
  ],
  bool androidUsesFineLocation = false,
}) async {
  if (connectionTypes.isEmpty) {
    throw Exception('No connection type provided');
  }

  if (connectionTypes.contains(ConnectionType.USB)) {
    await _getUSBPrinters();
  }

  if (connectionTypes.contains(ConnectionType.BLE)) {
    await _getBLEPrinters(androidUsesFineLocation);
  }
}