resolveOrNull<T> static method

T? resolveOrNull<T>(
  1. BuildContext context, {
  2. bool rebuild = false,
  3. String? tag,
})

Resolves T from the nearest ancestor MultiBinder containing a slot for T (and optional tag), walking parent MultiBinder scopes in O(1) hops without scanning intermediate non-binder elements.

Implementation

static T? resolveOrNull<T>(
  BuildContext context, {
  bool rebuild = false,
  String? tag,
}) {
  final match = findMatch(context, T, tag: tag);
  if (match == null) return null;
  return resolveMatch<T>(context, match.$1, match.$2, rebuild: rebuild);
}