getValue method

dynamic getValue(
  1. String key
)

Implementation

dynamic getValue(String key) {
  final val = _storage.read(key);
  if (val != null) {
    return val;
  }

  if (isWeb) {
    try {
      final localVal = html.window.localStorage[key];
      if (localVal != null) {
        _storage.write(key, localVal);
        return localVal;
      }

      final cookieVal = _getCookie(key);
      if (cookieVal != null) {
        _storage.write(key, cookieVal);
        return cookieVal;
      }
    } catch (_) {}
  }

  return null;
}