getUnsafe method

  1. @override
  2. @protected
dynamic getUnsafe(
  1. Type type, {
  2. bool? watch,
})
override

Retrieves the value of the requested type and optionally watches for its change. Returned values are guaranteed to be of type type or valueNotFound when it isn't found. If watch is not set, implementation should perform an educated guess (e.g. based on whether it's called during a build). Exact meaning of "watching" depends on the implementation and may not be supported.

Implementation

@override
@protected
dynamic getUnsafe(Type type, {bool? watch}) {
  assert(watch != true, "Watching is not supported in SimpleHookContext.getUnsafe()");
  if (!_provided.containsKey(type)) return ProviderContext.valueNotFound;
  return _provided[type];
}