PreviewButton.fromJson constructor

PreviewButton.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory PreviewButton.fromJson(Map<String, dynamic> json) {
  String _type = json["_type"];
  switch (_type) {
    case "PagePreviewMode":
      return PagePreviewMode.fromJson(json);
    case "TextButtonMode":
      return TextButtonMode.fromJson(json);
    case "NoButtonMode":
      return NoButtonMode.fromJson(json);
    default:
      throw ArgumentError("Invalid polymorphic type: $_type");
  }
}