debugGetOpenHandleStackTraces method Null safety

List<StackTrace>? debugGetOpenHandleStackTraces()

If asserts are enabled, returns the StackTraces of each open handle from clone, in creation order.

If asserts are disabled, this method always returns null.

Implementation

List<StackTrace>? debugGetOpenHandleStackTraces() {
  List<StackTrace>? stacks;
  assert(() {
    stacks = _image._handles.map((Image handle) => handle._debugStack!).toList();
    return true;
  }());
  return stacks;
}