Instabug for Flutter

A Flutter plugin for Instabug.

⚠️ This plugin is currently under active development and is not ready for production use yet. If you'd like to give us feedback or create a pull request, we would highly appreciate it!

Available Features

FeatureStatus
Bug Reporting⚙️
Crash Reporting
In-App Chat
In-App Surveys
Feature Requests
  • ✅ Stable
  • ⚙️ Under active development
  • ❌ Not available yet

APIs

The table below contains a list of APIs we're planning to implement for our 1.0 release. We'll add the Dart API methods as we implement them.

API MethodNative Equivalent (Android/iOS)
Instabug.start(String token, List<InvocationEvent> invocationEvents)new Instabug.Builder(this, "APP_TOKEN").build()
+ [Instabug startWithToken:invocationEvents:]
Instabug.showWelcomeMessageWithMode(WelcomeMessageMode welcomeMessageMode)Instabug.showWelcomeMessage(WelcomeMessage.State state)
+ [Instabug showWelcomeMessageWithMode:]
Instabug.identifyUserWithEmail(String email, [String name])Instabug.identifyUser(String username, String email)
+ [Instabug identifyUserWithEmail:name:]
Instabug.logOut()Instabug.logoutUser()
+ [Instabug logOut]
Instabug.setLocale(Locale locale)Instabug.setLocale(Locale locale)
+ [Instabug setLocale:]
Instabug.setColorTheme(ColorTheme colorTheme)Instabug.setColorTheme(InstabugColorTheme theme)
+ [Instabug setColorTheme:]
Instabug.appendTags(List<String> tags)Instabug.addTags(String... tags)
+ [Instabug appendTags:]
Instabug.resetTags()Instabug.resetTags()
+ [Instabug resetTags]
Instabug.getTags()Instabug.getTags()
+ [Instabug getTags]
Instabug.setStringForKey(String value, String key)Instabug.setCustomTextPlaceHolders(InstabugCustomTextPlaceHolder placeholder)
+ [Instabug setValue:forStringWithKey:]
Instabug.setUserAttributeWithKey(String value, String key)Instabug.setUserAttribute(String key, String value)
+ [Instabug setUserAttribute:withKey:]
Instabug.getUserAttributeForKey(Sring Key)Instabug.getUserAttribute(String key)
+ [Instabug userAttributeForKey:]
Instabug.removeUserAttributeForKey(String key)Instabug.removeUserAttribute(String key)
+ [Instabug removeUserAttributeForKey:]
Instabug.getUserAttributes()Instabug.getAllUserAttributes()
+ [Instabug userAttributes:]
Instabug.logUserEventWithName(String name)Instabug.logUserEvent(String name)
+ [Instabug logUserEventWithName:]
Instabug.show()Instabug.show()
+ [Instabug show]
Instabug.invokeWithMode(InvocationMode invocationMode, [List<InvocationOption> invocationOptions])BugReporting.invoke(InvocationMode mode, @InvocationOption int... options)
+ [IBGBugReporting invokeWithMode:options:]
Instabug.logDebug(String message)InstabugLog.d(String message)
+ [IBGLog logDebug:]
Instabug.logVerbose(String message)InstabugLog.v(String message)
+ [IBGLog logVerbose:]
Instabug.logInfo(String message)InstabugLog.i(String message)
+ [IBGLog logInfo:]
Instabug.logWarn(String message)InstabugLog.w(String message)
+ [IBGLog logWarn:]
Instabug.logError(String message)InstabugLog.e(String message)
+ [IBGLog logError:]
Instabug.clearAllLogs(String message)Instabug.clearLogs()
+ [IBGLog clearAllLogs:]

Integration

Creating a Flutter app on the Instabug dashboard isn't possible yet. Create a React Native app instead.

Installation

  1. Add Instabug to your pubspec.yaml file.
dependencies:
    instabug_flutter:
  1. Install the package by running the following command.
flutter packages get

Using Instabug

  1. To start using Instabug, import it into your Flutter app.
import 'package:instabug_flutter/instabug_flutter.dart';
  1. Initialize the SDK in initState(). This line enables the SDK with the default behavior and sets it to be shown when the devices is shaken.
InstabugFlutter.start('APP_TOKEN', [InvocationEvent.shake]);

Make sure to replace app_token with your application token.

  1. If your app supports Android, create a new Java class that extends FlutterApplication and add it to your AndroidManifest.xml.
<application
    android:name=".CustomFlutterApplication"
    ...
</application>
  1. In your newly created CustomFlutterApplication class, override onCreate() and add the following code.
ArrayList<String> invocationEvents = new ArrayList<>();
invocationEvents.add(InstabugFlutterPlugin.INVOCATION_EVENT_SHAKE);
new InstabugFlutterPlugin().start(CustomFlutterApplication.this, "APP_TOKEN", invocationEvents);
  1. For iOS apps, Instabug needs access to the microphone and photo library to be able to let users add audio and video attachments. Add the following 2 keys to your app’s Info.plist file with text explaining to the user why those permissions are needed:
  • NSMicrophoneUsageDescription
  • NSPhotoLibraryUsageDescription

If your app doesn’t already access the microphone or photo library, we recommend using a usage description like:

  • "<app name> needs access to the microphone to be able to attach voice notes."
  • "<app name> needs access to your photo library for you to be able to attach images."

The permission alert for accessing the microphone/photo library will NOT appear unless users attempt to attach a voice note/photo while using Instabug.

Libraries

instabug_flutter