forked from baron/baron-sso
38 lines
764 B
Dart
38 lines
764 B
Dart
// ignore_for_file: avoid_web_libraries_in_flutter
|
|
|
|
import 'dart:html' as html;
|
|
|
|
class WebStorage {
|
|
bool get isWeb => true;
|
|
|
|
String? get(String key) => html.window.localStorage[key];
|
|
|
|
void set(String key, String value) {
|
|
html.window.localStorage[key] = value;
|
|
}
|
|
|
|
String? getSession(String key) => html.window.sessionStorage[key];
|
|
|
|
void setSession(String key, String value) {
|
|
html.window.sessionStorage[key] = value;
|
|
}
|
|
|
|
void removeSession(String key) {
|
|
html.window.sessionStorage.remove(key);
|
|
}
|
|
|
|
void clearSession() {
|
|
html.window.sessionStorage.clear();
|
|
}
|
|
|
|
void remove(String key) {
|
|
html.window.localStorage.remove(key);
|
|
}
|
|
|
|
void clear() {
|
|
html.window.localStorage.clear();
|
|
}
|
|
}
|
|
|
|
final webStorage = WebStorage();
|