getStorageTemplate top-level property
This is code to be generated.
Implementation
String getStorageTemplate = """
/*
* Created by DartGenX CLI tool on ${DateFormat('EEE, dd MMM yyyy, h:mm a').format(DateTime.now())}
*/
import 'dart:developer';
import 'package:get_storage/get_storage.dart';
class GetStorageService {
GetStorageService._();
static final GetStorageService instance = GetStorageService._();
static late final GetStorage _storage;
Future<void> init({String containerName = 'GetStorage'}) async {
_storage = GetStorage(containerName);
final initialize = await GetStorage.init(containerName);
log(initialize ? "⚙️ Get Storage initialize successfully" : "🛑 Get Storage failed to initialized", name: "GetStorageService");
}
void setValueFor(String key, dynamic value) {
_storage.write(key, value);
}
dynamic valueFor(String key) {
return _storage.read(key);
}
void removeKey(String key) {
_storage.remove(key);
}
void clear() {
_storage.erase();
}
}
""";