parseCaller method
parse caller info from trace
Implementation
// protected
Map? parseCaller(String text) {
// skip '#0 '
int pos = text.indexOf(' ');
text = text.substring(pos + 1).trimLeft();
// split 'name' & '(path:line:column)'
pos = text.lastIndexOf(' ');
String name = text.substring(0, pos);
String tail = text.substring(pos + 1);
String path = 'unknown.file';
String line = '-1';
int pos1 = tail.indexOf(':');
if (pos1 > 0) {
pos = tail.indexOf(':', pos1 + 1);
if (pos > 0) {
path = tail.substring(1, pos);
pos1 = pos + 1;
pos = tail.indexOf(':', pos1);
if (pos > 0) {
line = tail.substring(pos1, pos);
} else if (pos1 < tail.length) {
line = tail.substring(pos1, tail.length - 1);
}
}
}
return {
'name': name,
'path': path,
'line': int.tryParse(line),
};
}