You can use package https://pub.dev/packages/instabug_flutter
For Android
, please follow step mentioned in Readme
Step 1: Add the following Maven repository to your project level build.gradle
allprojects {
repositories {
maven {
url "https://sdks.instabug.com/nexus/repository/instabug-cp"
}
}
}
Step 2: Create a new Java
class that extends FlutterApplication
and add it to your AndroidManifest.xml
.
<application
android:name=".CustomFlutterApplication"
...
</application>
Step 3: In your newly created CustomFlutterApplication
class, override onCreate()
and add the following code.
code of CustomFlutterApplication
from https://github.com/Instabug/Instabug-Flutter/blob/master/example/android/app/src/main/java/com/instabug/instabugflutterexample/CustomFlutterApplication.java
package com.instabug.instabugflutterexample;
import io.flutter.app.FlutterApplication;
import com.instabug.instabugflutter.InstabugFlutterPlugin;
import java.util.ArrayList;
public class CustomFlutterApplication extends FlutterApplication {
@Override
public void onCreate() {
super.onCreate();
ArrayList<String> invocation_events = new ArrayList<>();
invocation_events.add(InstabugFlutterPlugin.INVOCATION_EVENT_FLOATING_BUTTON);
InstabugFlutterPlugin instabug = new InstabugFlutterPlugin();
instabug.start(CustomFlutterApplication.this, "2d355f559ea67051a56fce82603f8e41", invocation_events);
instabug.setWelcomeMessageMode("WelcomeMessageMode.disabled");
}
}
Dart
example code snippet https://github.com/Instabug/Instabug-Flutter/blob/master/example/lib/main.dart
import 'dart:async';
import 'dart:io' show Platform;
import 'package:flutter/material.dart';
import 'package:instabug_flutter/Instabug.dart';
import 'package:instabug_flutter/BugReporting.dart';
import 'package:instabug_flutter/Surveys.dart';
import 'package:instabug_flutter/FeatureRequests.dart';
import 'package:instabug_flutter/CrashReporting.dart';
void main() async {
FlutterError.onError = (FlutterErrorDetails details) {
Zone.current.handleUncaughtError(details.exception, details.stack);
};
runZoned<Future<void>>(() async {
runApp(MyApp());
}, onError: (dynamic error, StackTrace stackTrace) {
CrashReporting.reportCrash(error, stackTrace);
});
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
String _platformVersion = 'Unknown';
@override
void initState() {
super.initState();
if (Platform.isIOS) {
Instabug.start('efa41f402620b5654f2af2b86e387029',
<InvocationEvent>[InvocationEvent.floatingButton]);
}
initPlatformState();
}