AfterSubmitAction.fromJson constructor

AfterSubmitAction.fromJson(
  1. dynamic json
)

Creates a new instance of the AfterSubmitAction class from the given JSON data.

Implementation

factory AfterSubmitAction.fromJson(dynamic json) => AfterSubmitAction(
      type: AfterSubmitActionType.values
          .firstWhere((type) => type.name == json['action']),
      buttonTitle: json['buttonTitle'],
      trigger: json['trigger'] != null
          ? AfterSubmitActionTrigger.values
              .firstWhere((trigger) => trigger.name == json['trigger'])
          : null,
      delay: json['delay'] != null ? Duration(seconds: json['delay']) : null,
      targetUrl:
          json['targetUrl'] != null ? Uri.parse(json['targetUrl']) : null,
    );