checkToastifyError method

void checkToastifyError()

Implementation

void checkToastifyError() async {
  var data = await _webController?.evaluateJavascript(
      source:
          "(function() { var item = document.getElementsByClassName('Toastify__toast-body')[0]; return item.innerHTML; })();");
  if (data is String) {
    if (data != "null" && data.isNotEmpty) {
      if (data.toLowerCase().contains("invalid share code")) {
        if (toastMessageTimeStamp + 2000 <
            DateTime.now().millisecondsSinceEpoch) {
          showLoader.value = false;
          showToast(data);
        }
        toastMessageTimeStamp = DateTime.now().millisecondsSinceEpoch;
      } else {
        showToast(
          data,
          callback: () => stopSdk(),
        );
      }
    }
  }
}