showDialog method

Future<AdaptyUIDialogActionType> showDialog(
  1. String viewId, {
  2. required String title,
  3. required String content,
  4. required String primaryActionTitle,
  5. String? secondaryActionTitle,
})

Call this function if you wish to present the dialog.

Parameters

  • title: The title of the dialog.
  • content: Descriptive text that provides additional details about the reason for the dialog.
  • primaryActionTitle: The action title to display as part of the dialog. If you provide two actions, be sure the defaultAction cancels the operation and leaves things unchanged.
  • secondaryActionTitle: The secondary action title to display as part of the dialog.

Implementation

Future<AdaptyUIDialogActionType> showDialog(
  String viewId, {
  required String title,
  required String content,
  required String primaryActionTitle,
  String? secondaryActionTitle,
}) async {
  final dialog = AdaptyUIDialog(
    title: title,
    content: content,
    primaryActionTitle: primaryActionTitle,
    secondaryActionTitle: secondaryActionTitle,
  );

  return await Adapty()._invokeMethod<AdaptyUIDialogActionType>(
    Method.showDialog,
    (data) => AdaptyUIDialogActionTypeJSONBuilder.fromJsonValue(data as String),
    {
      Argument.id: viewId,
      Argument.configuration: dialog.jsonValue,
    },
  );
}