goBackPages static method

Future<bool> goBackPages(
  1. int pages
)

Implementation

static Future<bool> goBackPages(int pages) async {
  try {
    String id = "fmlGo2";
    if (document.getElementById(id) == null) {
      var script = document.createElement("script");
      script.id = id;
      script.innerText = "function $id(i) { window.history.go(i); }";
      document.head!.append(script);
    }
    context.callMethod(id, [-1 * pages]);
    return true;
  } catch (e) {
    return false;
  }
}