Space.fromJson constructor

Space.fromJson(
  1. Map<String, Object?> json
)

Implementation

factory Space.fromJson(Map<String, Object?> json) {
  return Space(
    id: json[r'id'] as String?,
    key: json[r'key'] as String?,
    name: json[r'name'] as String?,
    type: json[r'type'] as String?,
    status: json[r'status'] as String?,
    authorId: json[r'authorId'] as String?,
    createdAt: DateTime.tryParse(json[r'createdAt'] as String? ?? ''),
    homepageId: json[r'homepageId'] as String?,
    description: json[r'description'] != null
        ? SpaceDescription.fromJson(
            json[r'description']! as Map<String, Object?>)
        : null,
    icon: json[r'icon'] != null
        ? SpaceIcon.fromJson(json[r'icon']! as Map<String, Object?>)
        : null,
  );
}