ActionModel.fromJson constructor

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

Creates an ActionModel from Form.io JSON response.

Implementation

factory ActionModel.fromJson(Map<String, dynamic> json) {
  return ActionModel(
    id: json['_id'] as String?,
    title: json['title'] as String? ?? '',
    name: json['name'] as String? ?? '',
    handler: json['handler'] as String? ?? '',
    method: (json['method'] as List<dynamic>?)?.map((e) => e.toString()).toList() ?? [],
    priority: json['priority'] as int? ?? 0,
    enabled: json['enabled'] as bool? ?? true,
    settings: Map<String, dynamic>.from(json['settings'] ?? {}),
    condition: json['condition'] != null ? Map<String, dynamic>.from(json['condition']) : null,
  );
}