🎨 Formatted all the code

This commit is contained in:
2024-05-01 17:37:34 +08:00
parent 28c0094837
commit cd5cfedb2f
51 changed files with 938 additions and 540 deletions

View File

@ -25,28 +25,29 @@ class Call {
});
factory Call.fromJson(Map<String, dynamic> json) => Call(
id: json["id"],
createdAt: DateTime.parse(json["created_at"]),
updatedAt: DateTime.parse(json["updated_at"]),
deletedAt: json["deleted_at"],
endedAt: json["ended_at"] != null ? DateTime.parse(json["ended_at"]) : null,
externalId: json["external_id"],
founderId: json["founder_id"],
channelId: json["channel_id"],
channel: Channel.fromJson(json["channel"]),
);
id: json["id"],
createdAt: DateTime.parse(json["created_at"]),
updatedAt: DateTime.parse(json["updated_at"]),
deletedAt: json["deleted_at"],
endedAt:
json["ended_at"] != null ? DateTime.parse(json["ended_at"]) : null,
externalId: json["external_id"],
founderId: json["founder_id"],
channelId: json["channel_id"],
channel: Channel.fromJson(json["channel"]),
);
Map<String, dynamic> toJson() => {
"id": id,
"created_at": createdAt.toIso8601String(),
"updated_at": updatedAt.toIso8601String(),
"deleted_at": deletedAt,
"ended_at": endedAt?.toIso8601String(),
"external_id": externalId,
"founder_id": founderId,
"channel_id": channelId,
"channel": channel.toJson(),
};
"id": id,
"created_at": createdAt.toIso8601String(),
"updated_at": updatedAt.toIso8601String(),
"deleted_at": deletedAt,
"ended_at": endedAt?.toIso8601String(),
"external_id": externalId,
"founder_id": founderId,
"channel_id": channelId,
"channel": channel.toJson(),
};
}
enum ParticipantStatsType {
@ -60,9 +61,9 @@ enum ParticipantStatsType {
class ParticipantTrack {
ParticipantTrack(
{required this.participant,
required this.videoTrack,
required this.isScreenShare});
required this.videoTrack,
required this.isScreenShare});
VideoTrack? videoTrack;
Participant participant;
bool isScreenShare;
}
}

View File

@ -32,36 +32,36 @@ class Channel {
});
factory Channel.fromJson(Map<String, dynamic> json) => Channel(
id: json["id"],
createdAt: DateTime.parse(json["created_at"]),
updatedAt: DateTime.parse(json["updated_at"]),
deletedAt: json["deleted_at"],
alias: json["alias"],
name: json["name"],
description: json["description"],
members: json["members"],
calls: json["calls"],
type: json["type"],
account: Account.fromJson(json["account"]),
accountId: json["account_id"],
realmId: json["realm_id"],
);
id: json["id"],
createdAt: DateTime.parse(json["created_at"]),
updatedAt: DateTime.parse(json["updated_at"]),
deletedAt: json["deleted_at"],
alias: json["alias"],
name: json["name"],
description: json["description"],
members: json["members"],
calls: json["calls"],
type: json["type"],
account: Account.fromJson(json["account"]),
accountId: json["account_id"],
realmId: json["realm_id"],
);
Map<String, dynamic> toJson() => {
"id": id,
"created_at": createdAt.toIso8601String(),
"updated_at": updatedAt.toIso8601String(),
"deleted_at": deletedAt,
"alias": alias,
"name": name,
"description": description,
"members": members,
"calls": calls,
"type": type,
"account": account,
"account_id": accountId,
"realm_id": realmId,
};
"id": id,
"created_at": createdAt.toIso8601String(),
"updated_at": updatedAt.toIso8601String(),
"deleted_at": deletedAt,
"alias": alias,
"name": name,
"description": description,
"members": members,
"calls": calls,
"type": type,
"account": account,
"account_id": accountId,
"realm_id": realmId,
};
}
class ChannelMember {
@ -86,24 +86,24 @@ class ChannelMember {
});
factory ChannelMember.fromJson(Map<String, dynamic> json) => ChannelMember(
id: json["id"],
createdAt: DateTime.parse(json["created_at"]),
updatedAt: DateTime.parse(json["updated_at"]),
deletedAt: json["deleted_at"],
channelId: json["channel_id"],
accountId: json["account_id"],
account: Account.fromJson(json["account"]),
notify: json["notify"],
);
id: json["id"],
createdAt: DateTime.parse(json["created_at"]),
updatedAt: DateTime.parse(json["updated_at"]),
deletedAt: json["deleted_at"],
channelId: json["channel_id"],
accountId: json["account_id"],
account: Account.fromJson(json["account"]),
notify: json["notify"],
);
Map<String, dynamic> toJson() => {
"id": id,
"created_at": createdAt.toIso8601String(),
"updated_at": updatedAt.toIso8601String(),
"deleted_at": deletedAt,
"channel_id": channelId,
"account_id": accountId,
"account": account.toJson(),
"notify": notify,
};
}
"id": id,
"created_at": createdAt.toIso8601String(),
"updated_at": updatedAt.toIso8601String(),
"deleted_at": deletedAt,
"channel_id": channelId,
"account_id": accountId,
"account": account.toJson(),
"notify": notify,
};
}

View File

@ -26,30 +26,30 @@ class Friendship {
});
factory Friendship.fromJson(Map<String, dynamic> json) => Friendship(
id: json["id"],
createdAt: DateTime.parse(json["created_at"]),
updatedAt: DateTime.parse(json["updated_at"]),
deletedAt: json["deleted_at"],
accountId: json["account_id"],
relatedId: json["related_id"],
blockedBy: json["blocked_by"],
account: Account.fromJson(json["account"]),
related: Account.fromJson(json["related"]),
status: json["status"],
);
id: json["id"],
createdAt: DateTime.parse(json["created_at"]),
updatedAt: DateTime.parse(json["updated_at"]),
deletedAt: json["deleted_at"],
accountId: json["account_id"],
relatedId: json["related_id"],
blockedBy: json["blocked_by"],
account: Account.fromJson(json["account"]),
related: Account.fromJson(json["related"]),
status: json["status"],
);
Map<String, dynamic> toJson() => {
"id": id,
"created_at": createdAt.toIso8601String(),
"updated_at": updatedAt.toIso8601String(),
"deleted_at": deletedAt,
"account_id": accountId,
"related_id": relatedId,
"blocked_by": blockedBy,
"account": account.toJson(),
"related": related.toJson(),
"status": status,
};
"id": id,
"created_at": createdAt.toIso8601String(),
"updated_at": updatedAt.toIso8601String(),
"deleted_at": deletedAt,
"account_id": accountId,
"related_id": relatedId,
"blocked_by": blockedBy,
"account": account.toJson(),
"related": related.toJson(),
"status": status,
};
Account getOtherside(int selfId) {
if (accountId != selfId) {
@ -58,4 +58,4 @@ class Friendship {
return related;
}
}
}
}

View File

@ -43,11 +43,15 @@ class Message {
content: json["content"],
metadata: json["metadata"],
type: json["type"],
attachments: List<Attachment>.from(json["attachments"]?.map((x) => Attachment.fromJson(x)) ?? List.empty()),
attachments: List<Attachment>.from(
json["attachments"]?.map((x) => Attachment.fromJson(x)) ??
List.empty()),
channel: Channel.fromJson(json["channel"]),
sender: Sender.fromJson(json["sender"]),
replyId: json["reply_id"],
replyTo: json["reply_to"] != null ? Message.fromJson(json["reply_to"]) : null,
replyTo: json["reply_to"] != null
? Message.fromJson(json["reply_to"])
: null,
channelId: json["channel_id"],
senderId: json["sender_id"],
);
@ -60,7 +64,8 @@ class Message {
"content": content,
"metadata": metadata,
"type": type,
"attachments": List<dynamic>.from(attachments?.map((x) => x.toJson()) ?? List.empty()),
"attachments": List<dynamic>.from(
attachments?.map((x) => x.toJson()) ?? List.empty()),
"channel": channel?.toJson(),
"sender": sender.toJson(),
"reply_id": replyId,

View File

@ -34,7 +34,9 @@ class Notification {
deletedAt: json["deleted_at"],
subject: json["subject"],
content: json["content"],
links: json["links"] != null ? List<Link>.from(json["links"].map((x) => Link.fromJson(x))) : List.empty(),
links: json["links"] != null
? List<Link>.from(json["links"].map((x) => Link.fromJson(x)))
: List.empty(),
isImportant: json["is_important"],
isRealtime: json["is_realtime"],
readAt: json["read_at"],
@ -49,7 +51,9 @@ class Notification {
"deleted_at": deletedAt,
"subject": subject,
"content": content,
"links": links != null ? List<dynamic>.from(links!.map((x) => x.toJson())) : List.empty(),
"links": links != null
? List<dynamic>.from(links!.map((x) => x.toJson()))
: List.empty(),
"is_important": isImportant,
"is_realtime": isRealtime,
"read_at": readAt,

View File

@ -10,14 +10,14 @@ class NetworkPackage {
});
factory NetworkPackage.fromJson(Map<String, dynamic> json) => NetworkPackage(
method: json["w"],
message: json["m"],
payload: json["p"],
);
method: json["w"],
message: json["m"],
payload: json["p"],
);
Map<String, dynamic> toJson() => {
"w": method,
"m": message,
"p": payload,
};
}
"w": method,
"m": message,
"p": payload,
};
}