clone method

Scope clone()

Clones the current Scope

Implementation

Scope clone() {
  final clone = Scope(_options)
    ..user = user
    ..fingerprint = List.from(fingerprint)
    ..transaction = transaction;

  for (final tag in _tags.keys) {
    clone.setTag(tag, _tags[tag]!);
  }

  for (final extraKey in _extra.keys) {
    clone.setExtra(extraKey, _extra[extraKey]);
  }

  for (final breadcrumb in _breadcrumbs) {
    clone.addBreadcrumb(breadcrumb);
  }

  for (final eventProcessor in _eventProcessors) {
    clone.addEventProcessor(eventProcessor);
  }

  contexts.forEach((key, value) {
    if (value != null) {
      clone.setContexts(key, value);
    }
  });

  return clone;
}