forked from lxm_flutter/json2dart
29 lines
615 B
Dart
29 lines
615 B
Dart
import 'dart:html';
|
|
|
|
const _entityKey = "entityKey";
|
|
|
|
class CookieHelper {
|
|
String loadJsonString() {
|
|
var storage = window.localStorage;
|
|
if (!storage.containsKey("json")) {
|
|
return "";
|
|
}
|
|
return window.localStorage["json"];
|
|
}
|
|
|
|
void saveJsonString(String jsonString) {
|
|
window.localStorage.addAll({"json": jsonString});
|
|
}
|
|
|
|
void saveEntityName(String entityName) {
|
|
window.localStorage.addAll({_entityKey: entityName});
|
|
}
|
|
|
|
String loadEntityName() {
|
|
if (!window.localStorage.containsKey(_entityKey)) {
|
|
return "";
|
|
}
|
|
return window.localStorage[_entityKey];
|
|
}
|
|
}
|