initMethod method
Future<void>
initMethod(
- BuildContext context, {
- required String appId,
- bool showNativeUI = false,
- Widget? customWidget()?,
override
context is required to show dialog
isShowNative is used to show customWidget
isShowNative turn it off if you want to show your customWidget
you can show your customWidget ui
Implementation
@override
Future<void> initMethod(
BuildContext context, {
required String appId,
bool showNativeUI = false,
Widget? Function(Map<String, dynamic> response)? customWidget,
}) async {
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
this.context = context;
final result = await methodChannel.invokeMethod(
'setApplicationID', {"AppId": appId, "showNativeUI": showNativeUI});
if (result) {
_listenToNativeMethod();
final appUpdateResponse = await _check();
if (customWidget != null) {
final widget = customWidget.call(appUpdateResponse);
///custom ui dialog
if (!showNativeUI && widget != null) {
_alertDialog(widget);
}
}
}
});
}