leaveBreadcrumb static method

Future<void> leaveBreadcrumb(
  1. String breadcrumb,
  2. BreadcrumbVisibility mode
)

Leaves a breadcrumb that will appear in a crash report and optionally, on the session.

Call this when something interesting happens in your application. The breadcrumb will be included in different reports depending on the mode. Each crash report displays the most recent 99 breadcrumbs.

If you would like it to appear also in sessions, use BreadcrumbVisibility.crashesAndSessions.

Use breadcrumb to include a message in the crash report and sessions. If it's longer than 2048 characters, it will be truncated. If it's empty, no breadcrumb will be recorded. Use mode with a value of BreadcrumbVisibility. If invalid, defaults to BreadcrumbVisibility.crashesOnly.

Method might throw Exception.

Future<void> showSignUp() async {
  try {
    await Instrumentation.leaveBreadcrumb("Pushing Sign up screen.",
     BreadcrumbVisibility.crashesAndSessions);
    await pushSignUpScreen();
  } catch (e) {
    // handle exception
  }
}

Implementation

static Future<void> leaveBreadcrumb(
  String breadcrumb,
  BreadcrumbVisibility mode,
) async {
  try {
    final arguments = {"breadcrumb": breadcrumb, "mode": mode.index};
    await channel.invokeMethod<void>('leaveBreadcrumb', arguments);
  } on PlatformException catch (e) {
    throw Exception(e.details);
  }
}