defaultStackTrace 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;
}

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.13.0/dart-async/AsyncError/defaultStackTrace.html