initialize method
Future<void>
initialize(
- BuildContext context, {
- bool shakeGestureEnable = true,
- Map<
String, dynamic> options = const {}, - required dynamic onRemarkResponse(),
override
Initializes the AppsOnAir AppRemark SDK.
context: Required to show a dialog or overlay.shakeGestureEnable: Determines whether the shake gesture is enabled for feedback (default is true).options: Additional configuration options for the SDK.
Implementation
@override
Future<void> initialize(
BuildContext context, {
bool shakeGestureEnable = true,
Map<String, dynamic> options = const {},
required Function(Map<String, dynamic>) onRemarkResponse,
}) async {
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
this.context = context;
_listenToNativeMethod();
// Setup EventChannel listener
_setupEventChannelListener(onRemarkResponse);
try {
final result = await methodChannel.invokeMethod('initializeAppRemark', {
"shakeGestureEnable": shakeGestureEnable,
'options': options,
});
if (result is! bool) {
log("AppRemark : ${result["error"]}");
}
} on PlatformException catch (e) {
debugPrint(
'Failed to initialize AppsOnAir AppRemarkSDK! ${e.message ?? ''}');
}
});
}