back method

dynamic back([
  1. int amount = 1
])

Move up to the parent context on the client hierarchy.

Every time a new link is created, a reference to the old context is kept to go back to.

@param amount The number of times you want to go back up the link stack. {-1} or {Infinity} will take you to the root. @returns a parent link context

Implementation

dynamic back([int amount = 1]) {
  if (amount < 0 || amount == double.maxFinite.toInt()) {
    return _client;
  }
  if (amount == 1) {
    return _parent ?? _client;
  }
  return back(amount - 1);
}