callerFrame function

String callerFrame(
  1. StackTrace? stack
)

Extract the first useful stack frame outside the slow operations module.

Implementation

String callerFrame(StackTrace? stack) {
  if (stack == null) return '';
  final lines = stack.toString().split('\n');
  for (final line in lines) {
    if (line.contains('status_notice.dart')) continue;
    final match = RegExp(r'([^/\\]+?):(\d+):\d+\)?$').firstMatch(line);
    if (match != null) return ' @ ${match.group(1)}:${match.group(2)}';
  }
  return '';
}