Adding custom data

User email

When you already have your users identified within your app, you might want to add their email automatically attached to the bug report. Bugsee provides APIs for setting, getting and clearing the email.

// setting email

// getting email, null will be returned if email was not set.
email = await Bugsee.getEmail();

// clearing email

User/Session attributes

Besides email, any arbitrary attributes can be attached to the report as well. Issues are searchable by these attributes in the Bugsee dashboard as well.

Note, that each attribute has a limit of 1kB and total size of all attributes must not be more than 25kB
Bugsee.setAttribute('age', 36);
Bugsee.setAttribute('name', 'John Doe');
Bugsee.setAttribute('married', false);

Once set, attributes persist until the application is uninstalled from the device. They can be cleared however using the following API.

// Clear a single attribute by name

// ... or clear all of them

Custom traces

Traces may be useful when you want to trace how a specific variable or state changes over time right before the problem happens.

// Number value
Bugsee.trace('credit_balance', 15);

// String value
Bugsee.trace('current_location', 'USA');

// Boolean value
Bugsee.trace('logged_in', true);

Custom events

Events are identified by a string and can have an optional dictionary of parameters that will be stored and passed along with the report.

// Without any additional parameters

// ...or with additional custom parameters
dynamic params = <String, dynamic>{};

params['amount'] = 125;
params['currency'] = 'USD';

Bugsee.event("event with params", parameters);

File Attachments

Binary files (attachments) can also be added to the report right before report is being sent. The attachment will be available for download right from the issue viewer. Currently both the amount of attachments and their size is limited. Max of 3 attachments, 3MB each (size increased from 1MB starting from v5.1.0).

Your should provide implementation for BugseeAttachmentsCallback and set it via setAttachmentsCallback() method.

Future<List<BugseeAttachment>> onBugseeAttachmentsRequest(BugseeReport report) {
  var attachments = <BugseeAttachment>[];
  var list = utf8.encode("This is the contents of the attachment!");
  var data = list is Uint8List ? list : new Uint8List.fromList(list);
  attachments.add(BugseeAttachment("testAttachment", "", data));
  return Future.value(attachments);