RoleModel.fromJson constructor

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

Creates a RoleModel from Form.io JSON response.

Implementation

factory RoleModel.fromJson(Map<String, dynamic> json) {
  return RoleModel(
    id: json['_id'] as String?,
    title: json['title'] as String? ?? '',
    description: json['description'] as String?,
    isDefault: json['default'] as bool? ?? false,
    admin: json['admin'] as bool? ?? false,
    created: json['created'] != null ? DateTime.tryParse(json['created']) : null,
    modified: json['modified'] != null ? DateTime.tryParse(json['modified']) : null,
  );
}