27 lines
713 B
Dart
27 lines
713 B
Dart
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
|
import 'package:universal_html/html.dart';
|
|
|
|
class StorageService {
|
|
static late String appDocsDir;
|
|
static late String appTempsDir;
|
|
static const FlutterSecureStorage _storage = FlutterSecureStorage();
|
|
|
|
static Future<void> setValue({
|
|
required String key,
|
|
required dynamic value,
|
|
}) async {
|
|
await _storage.write(key: key, value: value);
|
|
}
|
|
|
|
static Future getValue({required String key}) async {
|
|
final result = await _storage.read(key: key);
|
|
return result;
|
|
}
|
|
|
|
static Future<void> delete({required String key}) async {
|
|
_storage.delete(key: key);
|
|
}
|
|
|
|
static Storage get webStorage => window.localStorage;
|
|
}
|