init<V> method

V init<V>(
  1. String key,
  2. V init()
)

Implementation

V init<V>(String key, V Function() init) {
  final context = _context[_key] ??= {};
  if (!context.containsKey(key)) {
    context[key] = init();
  }

  final result = context[key];
  return result as V;
}