end method

void end({
  1. String? status,
})

Ends the span with status (defaults to success if not previously set).

Implementation

void end({String? status}) {
  if (_ended) return;
  _ended = true;

  final resolved = status ?? _status ?? ImageConstants.statusSuccess;
  span.setAttribute(
    Attribute.fromString(ImageConstants.attrLoadStatus, resolved),
  );
  if (_source == null) {
    span.setAttribute(
      Attribute.fromString(
        ImageConstants.attrSource,
        ImageConstants.sourceNetwork,
      ),
    );
  }

  span.end();
}