get<T, Y> method

Future<T> get<T, Y>(
  1. String key, [
  2. T converter(
    1. Y
    )?
])

get an object T from key position

a factory function converter can be provided to convert from stored type Y to desired return type T

Implementation

Future<T> get<T, Y>(String key, [T Function(Y)? converter]) async {
  if (converter == null) return _get<T>(key);
  return converter(await _get<Y>(key));
}