get method
Get value from storage
Implementation
Future<String?> get(String key) async {
try {
final lib = PlatformLoader.load();
final getFn = lib.lookupFunction<
Pointer<Utf8> Function(Pointer<Utf8>),
Pointer<Utf8> Function(Pointer<Utf8>)>('rac_storage_get');
final keyPtr = key.toNativeUtf8();
try {
final result = getFn(keyPtr);
if (result == nullptr) return null;
return result.toDartString();
} finally {
calloc.free(keyPtr);
}
} catch (e) {
_logger.debug('rac_storage_get not available: $e');
return null;
}
}