@@ -8,87 +8,45 @@ Sign up for a service at https://www.bugsee.com.
88
99Install Bugsee plugin into your dart project by adding it to dependecies in your pubspec.yaml
1010
11- ```
11+ ``` yaml
1212dependencies :
13- bugsee: any
13+ bugsee :
14+ git :
15+ url :
[email protected] :bugsee/flutter-bugsee.git 16+ # ref: 1.2.3 # if forcing a specific version by tag or branch
1417```
1518
16- Import Bugsee in every file you plan to call Bugsee API from:
19+ ## Launching
1720
1821``` dart
1922import 'package:bugsee/bugsee.dart';
20- ```
21-
22- ## Launching
23-
24- Bugsee SDK has to be launched within the native part of your application
25-
26- ### iOS
27-
28- Locate your ios/Runner/AppDelegate.m and add the following:
29-
30- ``` objectivec
31- #import " Bugsee/Bugsee.h"
32-
33- // / ...
3423
35- @implementation AppDelegate
24+ Future<Null> launchBugsee(Function(bool isBugseeLaunched) appRunner) async {
25+ var launchOptions;
26+ var bugseeToken = "";
3627
37- - (BOOL)application:(UIApplication * )application didFinishLaunchingWithOptions:(NSDictionary * )launchOptions {
38- [ GeneratedPluginRegistrant registerWithRegistry: self ] ;
28+ if (Platform.isAndroid) {
29+ bugseeToken = "<android app token>";
30+ launchOptions = new AndroidLaunchOptions();
31+ } else if (Platform.isIOS) {
32+ bugseeToken = "<ios app token>";
33+ launchOptions = new IOSLaunchOptions();
34+ }
3935
40- [ Bugsee launchWithToken:@"<YOUR APP TOKEN >"] ;
41-
42- // Override point for customization after application launch.
43- return [ super application: application didFinishLaunchingWithOptions: launchOptions ] ;
36+ await Bugsee.launch(bugseeToken,
37+ appRunCallback: appRunner, launchOptions: launchOptions);
4438}
45- ```
46-
47- Refer to official native iOS [documentation](https://docs.bugsee.com/sdk/ios/installation) for additional launch options.
48-
49- ### Android
50-
51- Add native Bugsee SDK to your build.gradle:
52-
53- ```groovy
54- dependencies {
55- implementation 'com.bugsee:bugsee-android:+'
56- }
57-
58- ```
59-
60- If you don't have it already, create your own class for main application and make sure you extend FlutterApplication when doing so.
61- Launch the Bigsee SDK from there:
6239
63- ``` java
64- import com.bugsee.library.Bugsee ;
65- import java.util.HashMap ;
66- import io.flutter.app.FlutterApplication ;
67-
68- public class MainApplication extends FlutterApplication {
69- @Override
70- public void onCreate () {
71- super . onCreate();
72- HashMap<String , Object > options = new HashMap<> ();
73-
74- // Regular doesn't capture anything in Flutter for now
75- options. put(Bugsee . Option . ExtendedVideoMode , true );
76- Bugsee . launch(this , " <YOUR APP TOKEN>" , options);
77- }
40+ Future<Null> main() async {
41+ await launchBugsee((bool isBugseeLaunched) async {
42+ runApp(new MyApp());
43+ });
7844}
7945
46+ class MyApp extends StatelessWidget {
47+ ....
8048```
8149
82- Modify the manifest to point to this Application:
83-
84- ``` xml
85- <application
86- android : name =" com.acme.app.MainApplication"
87- ...
88- ```
89-
90- Refer to official native Android [documentation](https://docs.bugsee.com/sdk/android/installation) for additional launch options.
91-
9250## Custom data
9351
9452### Events
@@ -126,52 +84,5 @@ try {
12684}
12785```
12886
129- ## Auto exception handling
130-
131- Create the following method in your code:
132-
133- ``` dart
134- Future<Null> _reportError(dynamic error, dynamic stackTrace) async {
135- print('Caught error: $error');
136-
137- await Bugsee.logException(
138- exception: error,
139- handled: false,
140- stackTrace: stackTrace,
141- );
142- }
143- ```
144-
145- Hook the method to execute on Flutter errors:
146-
147- ``` dart
148- // This captures errors reported by the Flutter framework.
149- FlutterError.onError = (FlutterErrorDetails details) async {
150- // In production mode report to the application zone to report to Bugsee.
151- Zone.current.handleUncaughtError(details.exception, details.stack);
152- };
153- ```
154-
155- Wrap your application to run in a Zone, which will catch most of the unhandled
156- errors automatically:
157-
158- ``` dart
159- // This creates a [Zone] that contains the Flutter application and stablishes
160- // an error handler that captures errors and reports them.
161- //
162- // Using a zone makes sure that as many errors as possible are captured,
163- // including those thrown from [Timer]s, microtasks, I/O, and those forwarded
164- // from the `FlutterError` handler.
165- //
166- // More about zones:
167- //
168- // - https://api.dartlang.org/stable/1.24.2/dart-async/Zone-class.html
169- // - https://www.dartlang.org/articles/libraries/zones
170- runZoned<Future<Null>>(() async {
171- runApp(new CrashyApp());
172- }, onError: (error, stackTrace) async {
173- await _reportError(error, stackTrace);
174- });
175- ```
17687
177- Bugsee can be further customized. For a complete SDK documentation covering additional options and API's visit [ https://docs.bugsee.com/sdk/flutter ] ( https://docs.bugsee.com/sdk/flutter )
88+ Bugsee can be further customized. For a complete SDK documentation covering additional options and API's visit [ https://docs.bugsee.com/sdk/flutter ] ( https://docs.bugsee.com/sdk/flutter )
0 commit comments