A Flutter plugin for Instabug.
Feature | Status |
---|---|
Bug Reporting | ✅ |
Crash Reporting | ⚠ |
In-App Chat | ✅ |
In-App Surveys | ✅ |
Feature Requests | ✅ |
- ✅ Stable
- ⚙️ Under active development
- ⚠ Not available yet
The section below contains the APIs we're planning to implement for our 1.0 release across different classes. We'll add the Dart API methods as we implement them.
API Method | Native Equivalent (Android/iOS) |
---|---|
start(String token, List<InvocationEvent> invocationEvents) |
new Instabug.Builder(this, "APP_TOKEN").build() + startWithToken:invocationEvents: |
showWelcomeMessageWithMode(WelcomeMessageMode welcomeMessageMode) |
showWelcomeMessage(WelcomeMessage.State state) + showWelcomeMessageWithMode: |
identifyUserWithEmail(String email, [String name]) |
identifyUser(String username, String email) + identifyUserWithEmail:name: |
logOut() |
logoutUser() + logOut |
setLocale(Locale locale) |
setLocale(Locale locale) + setLocale: |
setColorTheme(ColorTheme colorTheme) |
setColorTheme(InstabugColorTheme theme) + setColorTheme: |
appendTags(List<String> tags) |
addTags(String... tags) + appendTags: |
resetTags() |
resetTags() + resetTags |
getTags() |
getTags() + getTags |
setStringForKey(String value, String key) |
setCustomTextPlaceHolders(InstabugCustomTextPlaceHolder placeholder) + setValue:forStringWithKey: |
setUserAttributeWithKey(String value, String key) |
setUserAttribute(String key, String value) + setUserAttribute:withKey: |
getUserAttributeForKey(Sring Key) |
getUserAttribute(String key) + userAttributeForKey: |
removeUserAttributeForKey(String key) |
removeUserAttribute(String key) + removeUserAttributeForKey: |
getUserAttributes() |
getAllUserAttributes() + userAttributes: |
logUserEventWithName(String name) |
logUserEvent(String name) + logUserEventWithName: |
show() |
show() + show |
setSessionProfilerEnabled(bool sessionProfilerEnabled) |
setSessionProfilerState(Feature.State state) sessionProfilerEnabled |
setPrimaryColor(Color color) |
setPrimaryColor(@ColorInt int primaryColorValue) tintColor |
setUserData(String userData) |
setUserData(String userData) userData |
addFileAttachmentWithURL(String filePath, String fileName) |
addFileAttachment(Uri fileUri, String fileNameWithExtension) + addFileAttachmentWithURL: |
addFileAttachmentWithData(Uint8List data, String fileName) |
addFileAttachment(byte[] data, String fileNameWithExtension) + addFileAttachmentWithData: |
clearFileAttachments() |
clearFileAttachment() + clearFileAttachments |
setWelcomeMessageMode(WelcomeMessageMode welcomeMessageMode) |
setWelcomeMessageState(WelcomeMessage.State welcomeMessageState) welcomeMessageMode |
API Method | Native Equivalent (Android/iOS) |
---|---|
invokeWithMode(InvocationMode invocationMode, [List<InvocationOption> invocationOptions]) |
invoke(InvocationMode mode, @InvocationOption int... options) +invokeWithMode:options: |
setEnabled(bool isEnabled) |
setState(Feature.State state) enabled |
setOnInvokeCallback(Function function) |
setOnInvokeCallback(OnInvokeCallback onInvokeCallback) willInvokeHandler |
setOnDismissCallback(Function function) |
setOnDismissCallback(OnSdkDismissCallback onSdkDismissedCallback) didDismissHandler |
setInvocationEvents(List<InvocationEvent> invocationEvents) |
setInvocationEvents(InstabugInvocationEvent... invocationEvents) invocationEvents |
setEnabledAttachmentTypes(bool screenshot, bool extraScreenshot, bool galleryImage, bool screenRecording) |
setAttachmentTypesEnabled(boolean initial, boolean extra, boolean gallery, boolean recording enabledAttachmentTypes |
setReportTypes(List<ReportType> reportTypes) |
setReportTypes(@BugReporting.ReportType int... types) promptOptionsEnabledReportTypes |
setExtendedBugReportMode(ExtendedBugReportMode extendedBugReportMode) |
setExtendedBugReportState(ExtendedBugReport.State state) extendedBugReportMode |
setInvocationOptions(List<InvocationOption> invocationOptions) |
setOptions(@Option int... options) bugReportingOptions |
showWithOptions(ReportType reportType, List<InvocationOption> invocationOptions) |
show(@BugReporting.ReportType int type) + showWithReportType:options: |
API Method | Native Equivalent (Android/iOS) |
---|---|
logDebug(String message) |
d(String message) + logDebug: |
logVerbose(String message) |
v(String message) + logVerbose: |
logInfo(String message) |
i(String message) + logInfo: |
logWarn(String message) |
w(String message) + logWarn: |
logError(String message) |
e(String message) + logError: |
clearAllLogs(String message) |
clearLogs() + clearAllLogs: |
API Method | Native Equivalent (Android/iOS) |
---|---|
setEnabled(bool isEnabled) |
setState(Feature.State state) enabled |
setAutoShowingEnabled(bool isEnabled) |
setAutoShowingEnabled(boolean isAutoShowingEnabled) autoShowingEnabled |
getAvailableSurveys(Function function) |
getAvailableSurveys() + availableSurveys |
setOnShowCallback(Function function) |
setOnShowCallback(OnShowCallback onShowCallback) willShowSurveyHandler |
setOnDismissCallback(Function function) |
setOnDismissCallback(OnDismissCallback onDismissCallback) didDismissSurveyHandler |
setShouldShowWelcomeScreen(bool shouldShowWelcomeScreen) |
setShouldShowWelcomeScreen(boolean shouldShow) shouldShowWelcomeScreen |
showSurveyIfAvailable() |
showSurveyIfAvailable() + showSurveyIfAvailable |
showSurvey(String surveyToken) |
showSurvey(String token) + showSurveyWithToken: |
hasRespondedToSurvey(String surveyToken, Function function) |
hasRespondToSurvey(String token) + hasRespondedToSurveyWithToken: |
API Method | Native Equivalent (Android/iOS) |
---|---|
show() |
show() + show |
setEmailFieldRequired(bool isEmailFieldRequired, List<ActionType> actionTypes) |
setEmailFieldRequired(boolean isEmailRequired, ActionTypes actions) + setEmailFieldRequired:forAction: |
API Method | Native Equivalent (Android/iOS) |
---|---|
show() |
show() + show |
setEnabled(bool isEnabled) |
setState(Feature.State state) enabled |
API Method | Native Equivalent (Android/iOS) |
---|---|
setEnabled(bool isEnabled) |
setState(Feature.State state) enabled |
show() |
show() + show |
hasChats(Function function) |
hasChats() + hasChats |
setOnNewReplyReceivedCallback(Function function) |
setOnNewReplyReceivedCallback(Callback callback) didReceiveReplyHandler |
getUnreadRepliesCount(Function function) |
getUnreadRepliesCount() unreadRepliesCount |
setInAppNotificationsEnabled(bool isEnabled) |
setInAppNotificationEnabled(Boolean isChatNotificationEnable) inAppNotificationsEnabled |
setInAppNotificationSound(bool isEnabled) |
setInAppNotificationSound(Boolean shouldPlaySound) |
Creating a Flutter app on the Instabug dashboard isn't possible yet. Create a React Native app instead.
- Add Instabug to your
pubspec.yaml
file.
dependencies:
instabug:
- Install the package by running the following command.
flutter packages get
- To start using Instabug, import it into your Flutter app.
import 'package:instabug/Instabug.dart';
- Initialize the SDK in
initState()
. This line enables the SDK with the default behavior and sets it to be shown when the device is shaken. Ignore this if you're building for Android only.
Instabug.start('APP_TOKEN', [InvocationEvent.shake]);
- Add the following Maven repository to your project level
build.gradle
allprojects {
repositories {
maven {
url "https://sdks.instabug.com/nexus/repository/instabug-cp"
}
}
}
Make sure to replace app_token
with your application token.
- If your app supports Android, create a new Java class that extends
FlutterApplication
and add it to yourAndroidManifest.xml
.
<application
android:name=".CustomFlutterApplication"
...
</application>
- In your newly created
CustomFlutterApplication
class, overrideonCreate()
and add the following code.
ArrayList<String> invocationEvents = new ArrayList<>();
invocationEvents.add(InstabugFlutterPlugin.INVOCATION_EVENT_SHAKE);
new InstabugFlutterPlugin().start(CustomFlutterApplication.this, "APP_TOKEN", invocationEvents);
Instabug needs access to the microphone and photo library to be able to let users add audio and video attachments. Starting from iOS 10, apps that don’t provide a usage description for those 2 permissions would be rejected when submitted to the App Store.
For your app not to be rejected, you’ll need to 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.