getPrinterSettings method

Future<PrinterStatus> getPrinterSettings(
  1. List<PrinterSettingItem> keys,
  2. Map<PrinterSettingItem, String> outValues
)

Get printer settings. See Printer Configurations for available values.

Implementation

Future<PrinterStatus> getPrinterSettings(
    List<PrinterSettingItem> keys, Map<PrinterSettingItem, String> outValues) async {

  var params = {
    "printerId": mPrinterId,
    "printInfo": mPrinterInfo.toMap(),
    "keys": keys.map((printerSettingItem) => printerSettingItem.toMap()).toList()
  };

  final Map resultMap = await _channel.invokeMethod("getPrinterSettings", params);
  PrinterStatus status = PrinterStatus.fromMap(resultMap["printerStatus"]);
  Map<dynamic, dynamic> values = resultMap["values"];

  values.forEach((key, value) {
    outValues.putIfAbsent(PrinterSettingItem.fromMap(key), () => value);
  });

  return status;
}