nativeMethodCallHandler method

Future<void> nativeMethodCallHandler(
  1. MethodCall methodCall
)

Implementation

Future<void> nativeMethodCallHandler(MethodCall methodCall) async {
  if (methodCall.method == "printerFound") {
    final newPrinter = ZebraDevice(
      address: methodCall.arguments["Address"],
      name: methodCall.arguments["Name"],
      connected: false,
      isWifi: methodCall.arguments["IsWifi"] == "true",
    );
    notifier.addPrinter(newPrinter);
  } else if (methodCall.method == "changePrinterStatus") {
    final String status = methodCall.arguments["Status"];
    final String color = methodCall.arguments["Color"];
    notifier.updatePrinterStatus(status, color, selectedAddress);
  } else if (methodCall.method == "onPrinterDiscoveryDone") {
    notifier.isDone = true;
  } else if (methodCall.method == "onDiscoveryError" &&
      onDiscoveryError != null) {
    onDiscoveryError!(
        methodCall.arguments["ErrorCode"], methodCall.arguments["ErrorText"]);
  }
}