length method

int length({
  1. CStorageMethod method = CStorageMethod.local,
})

Total items stored in the identified CStorageMethod.

Implementation

int length({CStorageMethod method = CStorageMethod.local}) {
  if (method == CStorageMethod.local) {
    return web.window.localStorage.length;
  } else if (method == CStorageMethod.session) {
    return web.window.sessionStorage.length;
  } else {
    var ca = web.document.cookie.split(';');
    return ca.length;
  }
}