FormModel.fromJson constructor

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

Factory constructor that creates a FormModel from a Form.io JSON response.

Example input:

{
  "_id": "form123",
  "path": "contact",
  "title": "Contact Form",
  "components": [ ... ]
}

Implementation

factory FormModel.fromJson(Map<String, dynamic> json) {
  return FormModel(
    id: json['_id'] as String,
    path: json['path'] as String,
    title: json['title'] as String,
    components: (json['components'] as List<dynamic>).map((c) => ComponentModel.fromJson(c as Map<String, dynamic>)).toList(),
  );
}