CommsRole.fromJson constructor

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

Implementation

factory CommsRole.fromJson(Map<String, dynamic> json) {
  return CommsRole(
    id: json['id'] as int,
    name: json['name'] as String? ?? '',
    description: json['description'] as String? ?? '',
    createdAt: json['created_at'] != null
        ? DateTime.tryParse(json['created_at'] as String)
        : null,
    updatedAt: json['updated_at'] != null
        ? DateTime.tryParse(json['updated_at'] as String)
        : null,
  );
}