11import 'dart:async' ;
2- import 'package:flutter/foundation.dart' ;
32import 'package:flutter/services.dart' ;
43import 'package:instabug_flutter/Instabug.dart' ;
54
@@ -30,8 +29,8 @@ enum ExtendedBugReportMode {
3029
3130class BugReporting {
3231
33- static Function onInvokeCallback ;
34- static Function onDismissCallback ;
32+ static Function _onInvokeCallback ;
33+ static Function _onDismissCallback ;
3534 static const MethodChannel _channel = MethodChannel ('instabug_flutter' );
3635
3736 static Future <String > get platformVersion async {
@@ -42,10 +41,10 @@ class BugReporting {
4241 static Future <dynamic > _handleMethod (MethodCall call) async {
4342 switch (call.method) {
4443 case 'onInvokeCallback' :
45- onInvokeCallback ();
44+ _onInvokeCallback ();
4645 return ;
4746 case 'onDismissCallback' :
48- Map <dynamic , dynamic > map = call.arguments;
47+ final Map <dynamic , dynamic > map = call.arguments;
4948 DismissType dismissType;
5049 ReportType reportType;
5150 final String dismissTypeString = map['dismissType' ].toUpperCase ();
@@ -73,19 +72,19 @@ class BugReporting {
7372 break ;
7473 }
7574 try {
76- onDismissCallback (dismissType,reportType);
75+ _onDismissCallback (dismissType,reportType);
7776 }
7877 catch (exception) {
79- onDismissCallback ();
78+ _onDismissCallback ();
8079 }
8180 return ;
8281 }
8382}
8483 /// invoke sdk manually with desire invocation mode
8584 /// [invocationMode] the invocation mode
8685 /// [invocationOptions] the array of invocation options
87- static void invokeWithMode (InvocationMode invocationMode, [List <InvocationOption > invocationOptions]) async {
88- List <String > invocationOptionsStrings = < String > [];
86+ static void invoke (InvocationMode invocationMode, [List <InvocationOption > invocationOptions]) async {
87+ final List <String > invocationOptionsStrings = < String > [];
8988 if (invocationOptions != null ) {
9089 invocationOptions.forEach ((e) {
9190 invocationOptionsStrings.add (e.toString ());
@@ -108,7 +107,7 @@ class BugReporting {
108107 /// [function] A callback that gets executed before invoking the SDK
109108 static void setOnInvokeCallback (Function function) async {
110109 _channel.setMethodCallHandler (_handleMethod);
111- onInvokeCallback = function;
110+ _onInvokeCallback = function;
112111 await _channel.invokeMethod <Object >('setOnInvokeCallback' );
113112 }
114113
@@ -118,15 +117,15 @@ class BugReporting {
118117 /// [function] A callback that gets executed before invoking the SDK
119118 static void setOnDismissCallback (Function function) async {
120119 _channel.setMethodCallHandler (_handleMethod);
121- onDismissCallback = function;
120+ _onDismissCallback = function;
122121 await _channel.invokeMethod <Object >('setOnDismissCallback' );
123122 }
124123
125124 /// Sets the events that invoke the feedback form.
126125 /// Default is set by `Instabug.startWithToken` .
127126 /// [invocationEvents] invocationEvent List of events that invokes the
128127 static void setInvocationEvents (List <InvocationEvent > invocationEvents) async {
129- List <String > invocationEventsStrings = < String > [];
128+ final List <String > invocationEventsStrings = < String > [];
130129 if (invocationEvents != null ) {
131130 invocationEvents.forEach ((e) {
132131 invocationEventsStrings.add (e.toString ());
@@ -151,7 +150,7 @@ class BugReporting {
151150 ///Sets what type of reports, bug or feedback, should be invoked.
152151 /// [reportTypes] - List of reportTypes
153152 static void setReportTypes (List <ReportType > reportTypes) async {
154- List <String > reportTypesStrings = < String > [];
153+ final List <String > reportTypesStrings = < String > [];
155154 if (reportTypes != null ) {
156155 reportTypes.forEach ((e) {
157156 reportTypesStrings.add (e.toString ());
@@ -173,7 +172,7 @@ class BugReporting {
173172 /// Default is set by `Instabug.startWithToken` .
174173 /// [invocationOptions] List of invocation options
175174 static void setInvocationOptions (List <InvocationOption > invocationOptions) async {
176- List <String > invocationOptionsStrings = < String > [];
175+ final List <String > invocationOptionsStrings = < String > [];
177176 if (invocationOptions != null ) {
178177 invocationOptions.forEach ((e) {
179178 invocationOptionsStrings.add (e.toString ());
@@ -186,8 +185,8 @@ class BugReporting {
186185 /// Invoke bug reporting with report type and options.
187186 /// [reportType] type
188187 /// [invocationOptions] List of invocation options
189- static void showWithOptions (ReportType reportType, List <InvocationOption > invocationOptions) async {
190- List <String > invocationOptionsStrings = < String > [];
188+ static void show (ReportType reportType, List <InvocationOption > invocationOptions) async {
189+ final List <String > invocationOptionsStrings = < String > [];
191190 if (invocationOptions != null ) {
192191 invocationOptions.forEach ((e) {
193192 invocationOptionsStrings.add (e.toString ());
0 commit comments