Trace.from constructor Null safety

Trace.from(
  1. StackTrace trace
)

Returns a new stack trace containing the same data as trace.

If trace is a native StackTrace, its data will be parsed out; if it's a Trace, it will be returned as-is.

Implementation

factory Trace.from(StackTrace trace) {
  if (trace is Trace) return trace;
  if (trace is Chain) return trace.toTrace();
  return LazyTrace(() => Trace.parse(trace.toString()));
}