storeCookie static method

Future<Null> storeCookie(
  1. String cookie
)

Store DataDome cookie. The new value should be a string representing the cookie with its value and its attributes. Example: "datadome=xxxx; Max-Age=31536000; Domain=.yourdomain.com; Path=/; Secure; SameSite=Lax"

Implementation

static Future<Null> storeCookie(String cookie) async {
  if(!cookie.startsWith("datadome=") || cookie == lastCookieValue) {
    return null;
  }
  lastCookieValue = cookie;
  final prefs = await SharedPreferences.getInstance();
  prefs.setString('co.datadome.cookie', cookie);
  try {
    _channel.invokeMethod('storeCookie', { 'cookie': cookie });
  } on PlatformException catch (e) {
    DataDomeLogger.error("Error while sending message to native '${e.message}'");
  }
  sendMobileSignals();
}