이 시도 :
Date then = new Date.fromEpoch(0, new TimeZone.utc());
document.cookie = 'cookie_to_be_deleted=; expires=' + then.toString() + '; path=/';
이 나를 위해 일 https://gist.github.com/d2m/1935339
/*
* dart document.cookie lib
*
* ported from
* http://www.quirksmode.org/js/cookies.html
*
*/
void createCookie(String name, String value, int days) {
String expires;
if (days != null) {
Date now = new Date.now();
Date date = new Date.fromEpoch(now.value + days*24*60*60*1000, new TimeZone.local());
expires = '; expires=' + date.toString();
} else {
Date then = new Date.fromEpoch(0, new TimeZone.utc());
expires = '; expires=' + then.toString();
}
document.cookie = name + '=' + value + expires + '; path=/';
}
String readCookie(String name) {
String nameEQ = name + '=';
List<String> ca = document.cookie.split(';');
for (int i = 0; i < ca.length; i++) {
String c = ca[i];
c = c.trim();
if (c.indexOf(nameEQ) == 0) {
return c.substring(nameEQ.length);
}
}
return null;
}
void eraseCookie(String name) {
createCookie(name, '', null);
}
에서 이러한 유틸리티를 발견했다. 그러나 약간의 수정을해야했다. readCookie를 한번도 시도한 적이 없지만 createCookie에서 Date 객체로 Date 객체를 변경해야했으며 fromEpoch 함수 대신'now.add (days : days); '를 사용했습니다. – Spaceindaver