getLastConnectedPrinterName method

  1. @override
Future<String?> getLastConnectedPrinterName()
override

getLastConnectedPrinterName() returns a String representing the name of the last printer that the app connected to.

This is available to allow automatic connection. Since most users own and use only one printer, this can be called immediately after startPrinterDiscovery(). Therefore, when a printer is discovered with the same name as the "last connected printer" you may choose to call the connectToPrinter(String) method to connect to the familiar printer immediately at start up.

Implementation

@override
Future<String?> getLastConnectedPrinterName() async {
  String? lastConnectedPrinterName =
      await methodChannel.invokeMethod<String>('getLastConnectedPrinterName');
  return lastConnectedPrinterName;
}