Installation

SDK Installation

Install Bugsee plugin into your dart project by adding it to dependecies in your pubspec.yaml

dependencies:
  bugsee_flutter: ^3.0.0

Initialization

In order to allow Bugsee to properly intercept and report unhandled exceptions, it is best to first initialize Bugsee and then the rest of the app. This approach will guarantee that the app is running in a Zone, binding channel, etc. The following example also assume you are using different apps in Bugsee for Android and iOS deployments, this is very typical.

!Flutter 3 and up

import 'package:bugsee_flutter/bugsee.dart';

String getApplicationToken() {
  return Platform.isAndroid
      ? '<android-app-token>'
      : (Platform.isIOS ? '<ios-app-token>' : '');
}

Future<void> launchBugsee(
    void Function(bool isBugseeLaunched) appRunner) async {
  await Bugsee.launch(getApplicationToken(), appRunCallback: appRunner);
}

Future<void> main() async {
  // This is required to let Bugsee intercept network requests. You can
  // remove the line below if you don't want/need to intercept them.
  HttpOverrides.global = Bugsee.defaultHttpOverrides;

  await launchBugsee((bool isBugseeLaunched) async {
    runApp(const MyApp());
  });
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // ....
}

!Flutter 2.5 and up

import 'package:bugsee_flutter/bugsee_pre30.dart';

String getApplicationToken() {
  return Platform.isAndroid
      ? '<android-app-token>'
      : (Platform.isIOS ? '<ios-app-token>' : '');
}

Future<void> launchBugsee(
    void Function(bool isBugseeLaunched) appRunner) async {
  await Bugsee.launch(getApplicationToken(), appRunCallback: appRunner);
}

Future<void> main() async {
  // This is required to let Bugsee intercept network requests. You can
  // remove the line below if you don't want/need to intercept them.
  HttpOverrides.global = Bugsee.defaultHttpOverrides;

  await launchBugsee((bool isBugseeLaunched) async {
    runApp(const MyApp());
  });
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // ....
}

!Flutter pre-2.5

import 'package:bugsee_flutter/bugsee_pre25.dart';

String getApplicationToken() {
  return Platform.isAndroid
      ? '<android-app-token>'
      : (Platform.isIOS ? '<ios-app-token>' : '');
}

Future<void> launchBugsee(
    void Function(bool isBugseeLaunched) appRunner) async {
  await Bugsee.launch(getApplicationToken(), appRunCallback: appRunner);
}

Future<void> main() async {
  // This is required to let Bugsee intercept network requests. You can
  // remove the line below if you don't want/need to intercept them.
  HttpOverrides.global = Bugsee.defaultHttpOverrides;

  await launchBugsee((bool isBugseeLaunched) async {
    runApp(const MyApp());
  });
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // ....
}

See configuration to learn more on Bugsee launch options and customizations.