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 num?)?.toInt(),
    key: json[r'key'] as String? ?? '',
    name: json[r'name'] as String? ?? '',
    icon: json[r'icon'] != null
        ? Icon.fromJson(json[r'icon']! as Map<String, Object?>)
        : null,
    description: json[r'description'] != null
        ? SpaceDescriptionValue.fromJson(
            json[r'description']! as Map<String, Object?>)
        : null,
    homepage: json[r'homepage'] != null
        ? Content.fromJson(json[r'homepage']! as Map<String, Object?>)
        : null,
    type: json[r'type'] as String? ?? '',
    metadata: json[r'metadata'] != null
        ? SpaceMetadata.fromJson(json[r'metadata']! as Map<String, Object?>)
        : null,
    operations: (json[r'operations'] as List<Object?>?)
            ?.map((i) => OperationCheckResult.fromJson(
                i as Map<String, Object?>? ?? const {}))
            .toList() ??
        [],
    permissions: (json[r'permissions'] as List<Object?>?)
            ?.map((i) => SpacePermission.fromJson(
                i as Map<String, Object?>? ?? const {}))
            .toList() ??
        [],
    status: json[r'status'] as String? ?? '',
    settings: json[r'settings'] != null
        ? SpaceSettings.fromJson(json[r'settings']! as Map<String, Object?>)
        : null,
    theme: json[r'theme'] != null
        ? Theme.fromJson(json[r'theme']! as Map<String, Object?>)
        : null,
    lookAndFeel: json[r'lookAndFeel'] != null
        ? LookAndFeel.fromJson(json[r'lookAndFeel']! as Map<String, Object?>)
        : null,
    history: json[r'history'] != null
        ? SpaceHistory.fromJson(json[r'history']! as Map<String, Object?>)
        : null,
    expandable: SpaceExpandable.fromJson(
        json[r'_expandable'] as Map<String, Object?>? ?? const {}),
    links: GenericLinks.fromJson(
        json[r'_links'] as Map<String, Object?>? ?? const {}),
  );
}