User.fromJson constructor

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

Implementation

factory User.fromJson(Map<String, Object?> json) {
  return User(
    type: UserType.fromValue(json[r'type'] as String? ?? ''),
    username: json[r'username'] as String?,
    userKey: json[r'userKey'] as String?,
    accountId: json[r'accountId'] as String?,
    accountType: json[r'accountType'] != null
        ? UserAccountType.fromValue(json[r'accountType']! as String)
        : null,
    email: json[r'email'] as String?,
    publicName: json[r'publicName'] as String?,
    profilePicture: json[r'profilePicture'] != null
        ? Icon.fromJson(json[r'profilePicture']! as Map<String, Object?>)
        : null,
    displayName: json[r'displayName'] as String?,
    timeZone: json[r'timeZone'] as String?,
    isExternalCollaborator: json[r'isExternalCollaborator'] as bool? ?? false,
    externalCollaborator: json[r'externalCollaborator'] as bool? ?? false,
    operations: (json[r'operations'] as List<Object?>?)
            ?.map((i) => OperationCheckResult.fromJson(
                i as Map<String, Object?>? ?? const {}))
            .toList() ??
        [],
    details: json[r'details'] != null
        ? UserDetails.fromJson(json[r'details']! as Map<String, Object?>)
        : null,
    personalSpace: json[r'personalSpace'] != null
        ? Space.fromJson(json[r'personalSpace']! as Map<String, Object?>)
        : null,
    expandable: json[r'_expandable'] != null
        ? UserExpandable.fromJson(
            json[r'_expandable']! as Map<String, Object?>)
        : null,
    links: json[r'_links'] != null
        ? GenericLinks.fromJson(json[r'_links']! as Map<String, Object?>)
        : null,
  );
}