end method
Ends the span and logs the elapsed duration.
If extra is provided, it is appended to the log message.
Calling end multiple times is safe — subsequent calls are ignored.
Implementation
void end({String? extra}) {
if (_ended) return;
_ended = true;
_sw.stop();
if (!TuiTrace.enabled || !TuiTrace.isTagEnabled(_tag)) return;
final parts = StringBuffer();
parts.write('[${_tag.name}] ');
parts.write(_label);
if (_extra != null) {
parts.write(' $_extra');
}
if (extra != null) {
parts.write(' $extra');
}
parts.write(' ${_sw.elapsedMicroseconds}us');
TuiTrace._writeRaw(parts.toString());
}