Frame.caller constructor

Frame.caller([int level = 1 ])

Returns a single frame of the current stack.

By default, this will return the frame above the current method. If level is 0, it will return the current method's frame; if level is higher than 1, it will return higher frames.

Implementation

factory Frame.caller([int level = 1]) {
  if (level < 0) {
    throw new ArgumentError("Argument [level] must be greater than or equal "
        "to 0.");
  }

  return new Trace.current(level + 1).frames.first;
}