get<TType> method
Retrieves persisted data. Non-primitive types stored as JSON strings are automatically revived to their original types.
Implementation
dynamic get<TType>(String key) {
final value = _hiveBox?.get(key);
// FIX: only attempt JSON revival when the value is a String that looks like
// a JSON object — identified by our own wrapper sentinel, not a naive
// `contains('{')` check which would match ordinary user strings.
if (value is String) {
final trimmed = value.trimLeft();
if (trimmed.startsWith('{') || trimmed.startsWith('[')) {
return _reviveValue(key, value);
}
}
return value;
}