getCookie static method

Future<String> getCookie()

Returns the DataDome cookie. The returned value should be a string representing the cookie with the datadome name and its value. Example: "datadome=xxxx"

Implementation

static Future<String> getCookie() async {
  if(lastCookieValue.isNotEmpty) {
    return "datadome=" + parseCookieValue(lastCookieValue);
  }
  final prefs = await SharedPreferences.getInstance();
  String storedCookie = prefs.getString('co.datadome.cookie')?? '';
  return "datadome=" + parseCookieValue(storedCookie);
}