Skip to main content

Add a breadcrumb

Add context to sessions

Embrace can collect your logging data and include it as context within your sessions. Here's how you add a breadcrumb to the session:

import 'package:embrace/embrace.dart';

Embrace.instance.addBreadcrumb('a test breadcrumb message');

Use breadcrumbs to track the user's journey through your application. Avoid replicating data that would otherwise be recorded. For example, if you make a network call, Embrace can already track that, so you don't need to also create a breadcrumb for that event.

info

For tips on using breadcrumbs effectively, check out the Best Practices page.


We generally recommend using breadcrumbs for logging and not the Log Message API to add context to sessions. Breadcrumbs are a lightweight way to add logging to your session—they add no CPU or memory overhead and trigger no networking calls. The Log Message API is a much heavier mechanism. You can learn about it in the Alerting section of the documentation. For most cases, breadcrumbs are the right choice.