setCookie method

  1. @override
void setCookie(
  1. String url,
  2. String keyValue,
  3. String expires,
  4. JSPromise promise,
)
override

Implementation

@override
void setCookie(String url, String keyValue, String expires, JSPromise promise) {
  var cookies = <Cookie>[];
  var keyValueList = keyValue.split(';');
  for (var item in keyValueList) {
    var cookieInfo = item.split('=');
    var cookieItem = Cookie(cookieInfo[0], cookieInfo[1]);
    if (!isEmpty(expires)) {
      cookieItem.expires = DateTime.parse(expires);
    }
    cookies.add(cookieItem);
  }
  channel.CookieManager.getInstance().setCookie(url, cookies);
  promise.resolve(0);
}