Skip to content

Commit 1cb304e

Browse files
committed
📝 Added Check for Platform OS before calling start
1 parent 8f114a7 commit 1cb304e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

example/lib/main.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import 'package:flutter/material.dart';
22
import 'dart:async';
3-
3+
import 'dart:io' show Platform;
44
import 'package:flutter/services.dart';
55
import 'package:instabug_flutter/instabug_flutter.dart';
66

@@ -25,11 +25,12 @@ class _MyAppState extends State<MyApp> {
2525
String platformVersion;
2626
// Platform messages may fail, so we use a try/catch PlatformException.
2727
try {
28-
InstabugFlutter.start('9582e6cfe34e2b8897f48cfa3b617adb', [InvocationEvent.floatingButton, InvocationEvent.shake]);
28+
if (Platform.isIOS) {
29+
InstabugFlutter.start('9582e6cfe34e2b8897f48cfa3b617adb', [InvocationEvent.floatingButton, InvocationEvent.shake]);
30+
}
2931
} on PlatformException {
3032
platformVersion = 'Failed to get platform version.';
3133
}
32-
3334
// If the widget was removed from the tree while the asynchronous platform
3435
// message was in flight, we want to discard the reply rather than calling
3536
// setState to update our non-existent appearance.

0 commit comments

Comments
 (0)