Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add comments
  • Loading branch information
marandaneto committed Oct 13, 2020
commit 03405a04ef256cb61de54ed9aa359811ef989f57
12 changes: 8 additions & 4 deletions dart/lib/src/scope.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Scope {
/// they must be JSON-serializable.
final Map<String, dynamic> extra = {};

// TODO: eventProcessors, Contexts, BeforeBreadcrumbCallback, Breadcrumb hint, clome
// TODO: eventProcessors, Contexts, BeforeBreadcrumbCallback, Breadcrumb hint, clone

final SentryOptions _options;

Expand All @@ -52,13 +52,17 @@ class Scope {
void addBreadcrumb(Breadcrumb breadcrumb) {
assert(breadcrumb != null, "Breadcrumb can't be null");

// bail out if maxBreadcrumbs is zero
if (_options.maxBreadcrumbs == 0) {
return;
}

// remove first item if list if full
if (_breadcrumbs.length >= _options.maxBreadcrumbs &&
_breadcrumbs.isNotEmpty) {
_breadcrumbs.removeFirst();
}
if (_options.maxBreadcrumbs == 0) {
return;
}

_breadcrumbs.add(breadcrumb);
}

Expand Down