UserFlowField.fromJson constructor
UserFlowField.fromJson(
- Map<String, dynamic> json
)
Implementation
factory UserFlowField.fromJson(Map<String, dynamic> json) => UserFlowField(
fieldName: json["fieldName"],
label: json["label"],
type: FieldType.values.firstWhere(
(FieldType e) => e.name == json["type"],
orElse: () => FieldType.text,
),
isRequired: json["isRequired"] ?? true,
hint: json["hint"],
placeholder: json["placeholder"],
defaultValue: json["defaultValue"],
isDisabled: json["isDisabled"] ?? false,
isReadOnly: json["isReadOnly"] ?? false,
isHidden: json["isHidden"] ?? false,
validation: json["validation"] != null ? ValidationRules.fromJson(json["validation"]) : null,
options: json["options"] != null ? (json["options"] as List<dynamic>).map((dynamic e) => SelectOption.fromJson(e)).toList() : null,
dynamicOptions: json["dynamicOptions"] != null ? DynamicOptionsConfig.fromJson(json["dynamicOptions"]) : null,
dependency: json["dependency"] != null ? DependencyRule.fromJson(json["dependency"]) : null,
visibility: json["visibility"] != null ? VisibilityRule.fromJson(json["visibility"]) : null,
apiEndpoint: json["apiEndpoint"],
httpMethod: json["httpMethod"] ?? "PUT",
apiHeaders: json["apiHeaders"] != null ? Map<String, String>.from(json["apiHeaders"]) : null,
onApiResponse: json["onApiResponse"] != null ? ApiAction.fromJson(json["onApiResponse"]) : null,
debounceMs: json["debounceMs"],
autoSave: json["autoSave"] ?? true,
cssClass: json["cssClass"],
width: FieldWidth.values.firstWhere(
(FieldWidth e) => e.name == json["width"],
orElse: () => FieldWidth.full,
),
order: json["order"] ?? 0,
);