showInAppDialog static method

dynamic showInAppDialog(
  1. InAppModel inAppModel
)

Implementation

static showInAppDialog(InAppModel inAppModel) async {
  const storage = FlutterSecureStorage();
  final currentState = InngageProperties.navigatorKey.currentState;
  try {
    if (Navigator.canPop(currentState!.context)) {
      Navigator.pop(currentState.context);
      await storage.delete(key: 'inapp');
    }

    final dialog = await showDialog(
        context: currentState.context,
        builder: (context) {
          return InAppDialog(inAppModel: inAppModel);
        });

    if (dialog == null) {
      await storage.delete(key: 'inapp');
    }
  } catch (e) {
    log(e.toString());
  }
}