defaultStackTrace static method

StackTrace defaultStackTrace(
  1. Object error
)

A default stack trace for an error.

If error is an Error and it has an Error.stackTrace, that stack trace is returned. If not, the StackTrace.empty default stack trace is returned.

Implementation

static StackTrace defaultStackTrace(Object error) {
  if (error is Error) {
    var stackTrace = error.stackTrace;
    if (stackTrace != null) return stackTrace;
  }
  return StackTrace.empty;
}