runWithBindingOwner<R> method

R runWithBindingOwner<R>(
  1. String ownerRouteName,
  2. R body()
)

Runs body (a binding's dependencies()) attributing every dependency registration it creates to the route named ownerRouteName, so that the dependency is later linked to that route even when its first resolution happens while another route (e.g. a deep-linked descendant) is current.

Implementation

R runWithBindingOwner<R>(String ownerRouteName, R Function() body) {
  final previous = _bindingOwnerName;
  _bindingOwnerName = ownerRouteName;
  try {
    return body();
  } finally {
    _bindingOwnerName = previous;
  }
}