getWrapperKey method

Future<String> getWrapperKey(
  1. String url,
  2. {bool override = false}
)

Implementation

Future<String> getWrapperKey(
  String url, {
  bool override = false,
}) async {
  if (wrapperKey.isEmpty || override) {
    try {
      var res = await client.get(
        Uri.parse(url),
        headers: {'Accept': 'text/html'},
      );
      var body = res.body;
      var i = body.indexOf('wrapper_key = "');
      var bodyM = body.substring(i + 15);
      var j = bodyM.indexOf('"');
      return bodyM.substring(0, j);
    } catch (e) {
      throw e;
    }
  } else {
    return wrapperKey;
  }
}