Merge branch 'develop' into repo/dart-code-metrics

This commit is contained in:
Sahil Kumar
2021-10-07 18:13:34 +05:30
committed by GitHub
53 changed files with 862 additions and 794 deletions
+8
View File
@@ -177,6 +177,14 @@ Develop is merged into master after the team performs various automated and QA t
---
# Versioning Policy
All of the Stream Chat packages follow [semantic versioning (semver)](https://semver.org/).
See our [versioning policy documentation](https://getstream.io/chat/docs/sdk/flutter/basics/versioning_policy/) for more information.
---
# Styleguides 💅
![image](https://user-images.githubusercontent.com/20601437/124241186-d17a8680-db1b-11eb-9a21-3df305674ca9.png)
+5
View File
@@ -62,6 +62,11 @@ Every package folder includes a fully functional example with setup instructions
We also provide a set of sample apps created using the Stream Flutter SDK at [this location](https://github.com/GetStream/flutter-samples).
## Versioning Policy
All of the Stream Chat packages follow [semantic versioning (semver)](https://semver.org/).
See our [versioning policy documentation](https://getstream.io/chat/docs/sdk/flutter/basics/versioning_policy/) for more information.
## We are hiring
@@ -0,0 +1,20 @@
---
id: versioning_policy
sidebar_position: 3
title: Versioning Policy
---
All of the Stream Chat packages follow [semantic versioning (semver)](https://semver.org/).
That means that with a version number x.y.z (major.minor.patch):
- When releasing bug fixes (backwards compatible), we make a patch release by changing the z number (ex: 3.6.2 to 3.6.3). A bug fix is defined as an internal change that fixes incorrect behavior.
- When releasing new features or non-critical fixes, we make a minor release by changing the y number (ex: 3.6.2 to 3.7.0).
- When releasing breaking changes (backward incompatible), we make a major release by changing the x number (ex: 3.6.2 to 4.0.0).
See the [semantic versioning](https://dart.dev/tools/pub/versioning#semantic-versions) section from the Dart docs for more information.
This versioning policy does not apply to prerelease packages (below major version of 1). See this
[StackOverflow thread](https://stackoverflow.com/questions/66201337/how-do-dart-package-versions-work-how-should-i-version-my-flutter-plugins)
for more information on Dart package versioning.
Whenever possible, we will add deprecation warnings in preparation for future breaking changes.
+1 -1
View File
@@ -1,4 +1,4 @@
## Upcoming
## 3.1.1
✅ Added
@@ -15,7 +15,7 @@ class SortOption<T> {
/// ```
const SortOption(
this.field, {
this.direction = DESC,
this.direction = SortOption.DESC,
this.comparator,
});
@@ -6,12 +6,11 @@ part of 'requests.dart';
// JsonSerializableGenerator
// **************************************************************************
SortOption<T> _$SortOptionFromJson<T>(Map<String, dynamic> json) {
return SortOption<T>(
json['field'] as String,
direction: json['direction'] as int,
);
}
SortOption<T> _$SortOptionFromJson<T>(Map<String, dynamic> json) =>
SortOption<T>(
json['field'] as String,
direction: json['direction'] as int? ?? SortOption.DESC,
);
Map<String, dynamic> _$SortOptionToJson<T>(SortOption<T> instance) =>
<String, dynamic>{
@@ -19,22 +18,20 @@ Map<String, dynamic> _$SortOptionToJson<T>(SortOption<T> instance) =>
'direction': instance.direction,
};
PaginationParams _$PaginationParamsFromJson(Map<String, dynamic> json) {
return PaginationParams(
limit: json['limit'] as int,
offset: json['offset'] as int,
next: json['next'] as String?,
greaterThan: json['id_gt'] as String?,
greaterThanOrEqual: json['id_gte'] as String?,
lessThan: json['id_lt'] as String?,
lessThanOrEqual: json['id_lte'] as String?,
);
}
PaginationParams _$PaginationParamsFromJson(Map<String, dynamic> json) =>
PaginationParams(
limit: json['limit'] as int? ?? 10,
offset: json['offset'] as int?,
next: json['next'] as String?,
greaterThan: json['id_gt'] as String?,
greaterThanOrEqual: json['id_gte'] as String?,
lessThan: json['id_lt'] as String?,
lessThanOrEqual: json['id_lte'] as String?,
);
Map<String, dynamic> _$PaginationParamsToJson(PaginationParams instance) {
final val = <String, dynamic>{
'limit': instance.limit,
'offset': instance.offset,
};
void writeNotNull(String key, dynamic value) {
@@ -43,6 +40,7 @@ Map<String, dynamic> _$PaginationParamsToJson(PaginationParams instance) {
}
}
writeNotNull('offset', instance.offset);
writeNotNull('next', instance.next);
writeNotNull('id_gt', instance.greaterThan);
writeNotNull('id_gte', instance.greaterThanOrEqual);
@@ -6,14 +6,13 @@ part of 'responses.dart';
// JsonSerializableGenerator
// **************************************************************************
ErrorResponse _$ErrorResponseFromJson(Map<String, dynamic> json) {
return ErrorResponse()
..duration = json['duration'] as String?
..code = json['code'] as int?
..message = json['message'] as String?
..statusCode = json['StatusCode'] as int?
..moreInfo = json['more_info'] as String?;
}
ErrorResponse _$ErrorResponseFromJson(Map<String, dynamic> json) =>
ErrorResponse()
..duration = json['duration'] as String?
..code = json['code'] as int?
..message = json['message'] as String?
..statusCode = json['StatusCode'] as int?
..moreInfo = json['more_info'] as String?;
Map<String, dynamic> _$ErrorResponseToJson(ErrorResponse instance) =>
<String, dynamic>{
@@ -24,275 +23,253 @@ Map<String, dynamic> _$ErrorResponseToJson(ErrorResponse instance) =>
'more_info': instance.moreInfo,
};
SyncResponse _$SyncResponseFromJson(Map<String, dynamic> json) {
return SyncResponse()
..duration = json['duration'] as String?
..events = (json['events'] as List<dynamic>?)
?.map((e) => Event.fromJson(e as Map<String, dynamic>))
.toList() ??
[];
}
SyncResponse _$SyncResponseFromJson(Map<String, dynamic> json) => SyncResponse()
..duration = json['duration'] as String?
..events = (json['events'] as List<dynamic>?)
?.map((e) => Event.fromJson(e as Map<String, dynamic>))
.toList() ??
[];
QueryChannelsResponse _$QueryChannelsResponseFromJson(
Map<String, dynamic> json) {
return QueryChannelsResponse()
..duration = json['duration'] as String?
..channels = (json['channels'] as List<dynamic>?)
?.map((e) => ChannelState.fromJson(e as Map<String, dynamic>))
.toList() ??
[];
}
Map<String, dynamic> json) =>
QueryChannelsResponse()
..duration = json['duration'] as String?
..channels = (json['channels'] as List<dynamic>?)
?.map((e) => ChannelState.fromJson(e as Map<String, dynamic>))
.toList() ??
[];
TranslateMessageResponse _$TranslateMessageResponseFromJson(
Map<String, dynamic> json) {
return TranslateMessageResponse()
..duration = json['duration'] as String?
..message = Message.fromJson(json['message'] as Map<String, dynamic>);
}
Map<String, dynamic> json) =>
TranslateMessageResponse()
..duration = json['duration'] as String?
..message = Message.fromJson(json['message'] as Map<String, dynamic>);
QueryMembersResponse _$QueryMembersResponseFromJson(Map<String, dynamic> json) {
return QueryMembersResponse()
..duration = json['duration'] as String?
..members = (json['members'] as List<dynamic>?)
?.map((e) => Member.fromJson(e as Map<String, dynamic>))
.toList() ??
[];
}
QueryMembersResponse _$QueryMembersResponseFromJson(
Map<String, dynamic> json) =>
QueryMembersResponse()
..duration = json['duration'] as String?
..members = (json['members'] as List<dynamic>?)
?.map((e) => Member.fromJson(e as Map<String, dynamic>))
.toList() ??
[];
QueryUsersResponse _$QueryUsersResponseFromJson(Map<String, dynamic> json) {
return QueryUsersResponse()
..duration = json['duration'] as String?
..users = (json['users'] as List<dynamic>?)
?.map((e) => User.fromJson(e as Map<String, dynamic>))
.toList() ??
[];
}
QueryUsersResponse _$QueryUsersResponseFromJson(Map<String, dynamic> json) =>
QueryUsersResponse()
..duration = json['duration'] as String?
..users = (json['users'] as List<dynamic>?)
?.map((e) => User.fromJson(e as Map<String, dynamic>))
.toList() ??
[];
QueryReactionsResponse _$QueryReactionsResponseFromJson(
Map<String, dynamic> json) {
return QueryReactionsResponse()
..duration = json['duration'] as String?
..reactions = (json['reactions'] as List<dynamic>?)
?.map((e) => Reaction.fromJson(e as Map<String, dynamic>))
.toList() ??
[];
}
Map<String, dynamic> json) =>
QueryReactionsResponse()
..duration = json['duration'] as String?
..reactions = (json['reactions'] as List<dynamic>?)
?.map((e) => Reaction.fromJson(e as Map<String, dynamic>))
.toList() ??
[];
QueryRepliesResponse _$QueryRepliesResponseFromJson(Map<String, dynamic> json) {
return QueryRepliesResponse()
..duration = json['duration'] as String?
..messages = (json['messages'] as List<dynamic>?)
?.map((e) => Message.fromJson(e as Map<String, dynamic>))
.toList() ??
[];
}
QueryRepliesResponse _$QueryRepliesResponseFromJson(
Map<String, dynamic> json) =>
QueryRepliesResponse()
..duration = json['duration'] as String?
..messages = (json['messages'] as List<dynamic>?)
?.map((e) => Message.fromJson(e as Map<String, dynamic>))
.toList() ??
[];
ListDevicesResponse _$ListDevicesResponseFromJson(Map<String, dynamic> json) {
return ListDevicesResponse()
..duration = json['duration'] as String?
..devices = (json['devices'] as List<dynamic>?)
?.map((e) => Device.fromJson(e as Map<String, dynamic>))
.toList() ??
[];
}
ListDevicesResponse _$ListDevicesResponseFromJson(Map<String, dynamic> json) =>
ListDevicesResponse()
..duration = json['duration'] as String?
..devices = (json['devices'] as List<dynamic>?)
?.map((e) => Device.fromJson(e as Map<String, dynamic>))
.toList() ??
[];
SendFileResponse _$SendFileResponseFromJson(Map<String, dynamic> json) {
return SendFileResponse()
..duration = json['duration'] as String?
..file = json['file'] as String;
}
SendFileResponse _$SendFileResponseFromJson(Map<String, dynamic> json) =>
SendFileResponse()
..duration = json['duration'] as String?
..file = json['file'] as String;
SendImageResponse _$SendImageResponseFromJson(Map<String, dynamic> json) {
return SendImageResponse()
..duration = json['duration'] as String?
..file = json['file'] as String;
}
SendImageResponse _$SendImageResponseFromJson(Map<String, dynamic> json) =>
SendImageResponse()
..duration = json['duration'] as String?
..file = json['file'] as String;
SendReactionResponse _$SendReactionResponseFromJson(Map<String, dynamic> json) {
return SendReactionResponse()
..duration = json['duration'] as String?
..message = Message.fromJson(json['message'] as Map<String, dynamic>)
..reaction = Reaction.fromJson(json['reaction'] as Map<String, dynamic>);
}
SendReactionResponse _$SendReactionResponseFromJson(
Map<String, dynamic> json) =>
SendReactionResponse()
..duration = json['duration'] as String?
..message = Message.fromJson(json['message'] as Map<String, dynamic>)
..reaction = Reaction.fromJson(json['reaction'] as Map<String, dynamic>);
ConnectGuestUserResponse _$ConnectGuestUserResponseFromJson(
Map<String, dynamic> json) {
return ConnectGuestUserResponse()
..duration = json['duration'] as String?
..accessToken = json['access_token'] as String
..user = User.fromJson(json['user'] as Map<String, dynamic>);
}
Map<String, dynamic> json) =>
ConnectGuestUserResponse()
..duration = json['duration'] as String?
..accessToken = json['access_token'] as String
..user = User.fromJson(json['user'] as Map<String, dynamic>);
UpdateUsersResponse _$UpdateUsersResponseFromJson(Map<String, dynamic> json) {
return UpdateUsersResponse()
..duration = json['duration'] as String?
..users = (json['users'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, User.fromJson(e as Map<String, dynamic>)),
) ??
{};
}
UpdateUsersResponse _$UpdateUsersResponseFromJson(Map<String, dynamic> json) =>
UpdateUsersResponse()
..duration = json['duration'] as String?
..users = (json['users'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, User.fromJson(e as Map<String, dynamic>)),
) ??
{};
UpdateMessageResponse _$UpdateMessageResponseFromJson(
Map<String, dynamic> json) {
return UpdateMessageResponse()
..duration = json['duration'] as String?
..message = Message.fromJson(json['message'] as Map<String, dynamic>);
}
Map<String, dynamic> json) =>
UpdateMessageResponse()
..duration = json['duration'] as String?
..message = Message.fromJson(json['message'] as Map<String, dynamic>);
SendMessageResponse _$SendMessageResponseFromJson(Map<String, dynamic> json) {
return SendMessageResponse()
..duration = json['duration'] as String?
..message = Message.fromJson(json['message'] as Map<String, dynamic>);
}
SendMessageResponse _$SendMessageResponseFromJson(Map<String, dynamic> json) =>
SendMessageResponse()
..duration = json['duration'] as String?
..message = Message.fromJson(json['message'] as Map<String, dynamic>);
GetMessageResponse _$GetMessageResponseFromJson(Map<String, dynamic> json) {
return GetMessageResponse()
..duration = json['duration'] as String?
..message = Message.fromJson(json['message'] as Map<String, dynamic>)
..channel = json['channel'] == null
? null
: ChannelModel.fromJson(json['channel'] as Map<String, dynamic>);
}
GetMessageResponse _$GetMessageResponseFromJson(Map<String, dynamic> json) =>
GetMessageResponse()
..duration = json['duration'] as String?
..message = Message.fromJson(json['message'] as Map<String, dynamic>)
..channel = json['channel'] == null
? null
: ChannelModel.fromJson(json['channel'] as Map<String, dynamic>);
SearchMessagesResponse _$SearchMessagesResponseFromJson(
Map<String, dynamic> json) {
return SearchMessagesResponse()
..duration = json['duration'] as String?
..results = (json['results'] as List<dynamic>?)
?.map((e) => GetMessageResponse.fromJson(e as Map<String, dynamic>))
.toList() ??
[]
..next = json['next'] as String?
..previous = json['previous'] as String?;
}
Map<String, dynamic> json) =>
SearchMessagesResponse()
..duration = json['duration'] as String?
..results = (json['results'] as List<dynamic>?)
?.map(
(e) => GetMessageResponse.fromJson(e as Map<String, dynamic>))
.toList() ??
[]
..next = json['next'] as String?
..previous = json['previous'] as String?;
GetMessagesByIdResponse _$GetMessagesByIdResponseFromJson(
Map<String, dynamic> json) {
return GetMessagesByIdResponse()
..duration = json['duration'] as String?
..messages = (json['messages'] as List<dynamic>?)
?.map((e) => Message.fromJson(e as Map<String, dynamic>))
.toList() ??
[];
}
Map<String, dynamic> json) =>
GetMessagesByIdResponse()
..duration = json['duration'] as String?
..messages = (json['messages'] as List<dynamic>?)
?.map((e) => Message.fromJson(e as Map<String, dynamic>))
.toList() ??
[];
UpdateChannelResponse _$UpdateChannelResponseFromJson(
Map<String, dynamic> json) {
return UpdateChannelResponse()
..duration = json['duration'] as String?
..channel = ChannelModel.fromJson(json['channel'] as Map<String, dynamic>)
..members = (json['members'] as List<dynamic>?)
?.map((e) => Member.fromJson(e as Map<String, dynamic>))
.toList()
..message = json['message'] == null
? null
: Message.fromJson(json['message'] as Map<String, dynamic>);
}
Map<String, dynamic> json) =>
UpdateChannelResponse()
..duration = json['duration'] as String?
..channel = ChannelModel.fromJson(json['channel'] as Map<String, dynamic>)
..members = (json['members'] as List<dynamic>?)
?.map((e) => Member.fromJson(e as Map<String, dynamic>))
.toList()
..message = json['message'] == null
? null
: Message.fromJson(json['message'] as Map<String, dynamic>);
PartialUpdateChannelResponse _$PartialUpdateChannelResponseFromJson(
Map<String, dynamic> json) {
return PartialUpdateChannelResponse()
..duration = json['duration'] as String?
..channel = ChannelModel.fromJson(json['channel'] as Map<String, dynamic>)
..members = (json['members'] as List<dynamic>?)
?.map((e) => Member.fromJson(e as Map<String, dynamic>))
.toList();
}
Map<String, dynamic> json) =>
PartialUpdateChannelResponse()
..duration = json['duration'] as String?
..channel = ChannelModel.fromJson(json['channel'] as Map<String, dynamic>)
..members = (json['members'] as List<dynamic>?)
?.map((e) => Member.fromJson(e as Map<String, dynamic>))
.toList();
InviteMembersResponse _$InviteMembersResponseFromJson(
Map<String, dynamic> json) {
return InviteMembersResponse()
..duration = json['duration'] as String?
..channel = ChannelModel.fromJson(json['channel'] as Map<String, dynamic>)
..members = (json['members'] as List<dynamic>?)
?.map((e) => Member.fromJson(e as Map<String, dynamic>))
.toList() ??
[]
..message = json['message'] == null
? null
: Message.fromJson(json['message'] as Map<String, dynamic>);
}
Map<String, dynamic> json) =>
InviteMembersResponse()
..duration = json['duration'] as String?
..channel = ChannelModel.fromJson(json['channel'] as Map<String, dynamic>)
..members = (json['members'] as List<dynamic>?)
?.map((e) => Member.fromJson(e as Map<String, dynamic>))
.toList() ??
[]
..message = json['message'] == null
? null
: Message.fromJson(json['message'] as Map<String, dynamic>);
RemoveMembersResponse _$RemoveMembersResponseFromJson(
Map<String, dynamic> json) {
return RemoveMembersResponse()
..duration = json['duration'] as String?
..channel = ChannelModel.fromJson(json['channel'] as Map<String, dynamic>)
..members = (json['members'] as List<dynamic>?)
?.map((e) => Member.fromJson(e as Map<String, dynamic>))
.toList() ??
[]
..message = json['message'] == null
? null
: Message.fromJson(json['message'] as Map<String, dynamic>);
}
Map<String, dynamic> json) =>
RemoveMembersResponse()
..duration = json['duration'] as String?
..channel = ChannelModel.fromJson(json['channel'] as Map<String, dynamic>)
..members = (json['members'] as List<dynamic>?)
?.map((e) => Member.fromJson(e as Map<String, dynamic>))
.toList() ??
[]
..message = json['message'] == null
? null
: Message.fromJson(json['message'] as Map<String, dynamic>);
SendActionResponse _$SendActionResponseFromJson(Map<String, dynamic> json) {
return SendActionResponse()
..duration = json['duration'] as String?
..message = json['message'] == null
? null
: Message.fromJson(json['message'] as Map<String, dynamic>);
}
SendActionResponse _$SendActionResponseFromJson(Map<String, dynamic> json) =>
SendActionResponse()
..duration = json['duration'] as String?
..message = json['message'] == null
? null
: Message.fromJson(json['message'] as Map<String, dynamic>);
AddMembersResponse _$AddMembersResponseFromJson(Map<String, dynamic> json) {
return AddMembersResponse()
..duration = json['duration'] as String?
..channel = ChannelModel.fromJson(json['channel'] as Map<String, dynamic>)
..members = (json['members'] as List<dynamic>?)
?.map((e) => Member.fromJson(e as Map<String, dynamic>))
.toList() ??
[]
..message = json['message'] == null
? null
: Message.fromJson(json['message'] as Map<String, dynamic>);
}
AddMembersResponse _$AddMembersResponseFromJson(Map<String, dynamic> json) =>
AddMembersResponse()
..duration = json['duration'] as String?
..channel = ChannelModel.fromJson(json['channel'] as Map<String, dynamic>)
..members = (json['members'] as List<dynamic>?)
?.map((e) => Member.fromJson(e as Map<String, dynamic>))
.toList() ??
[]
..message = json['message'] == null
? null
: Message.fromJson(json['message'] as Map<String, dynamic>);
AcceptInviteResponse _$AcceptInviteResponseFromJson(Map<String, dynamic> json) {
return AcceptInviteResponse()
..duration = json['duration'] as String?
..channel = ChannelModel.fromJson(json['channel'] as Map<String, dynamic>)
..members = (json['members'] as List<dynamic>?)
?.map((e) => Member.fromJson(e as Map<String, dynamic>))
.toList() ??
[]
..message = json['message'] == null
? null
: Message.fromJson(json['message'] as Map<String, dynamic>);
}
AcceptInviteResponse _$AcceptInviteResponseFromJson(
Map<String, dynamic> json) =>
AcceptInviteResponse()
..duration = json['duration'] as String?
..channel = ChannelModel.fromJson(json['channel'] as Map<String, dynamic>)
..members = (json['members'] as List<dynamic>?)
?.map((e) => Member.fromJson(e as Map<String, dynamic>))
.toList() ??
[]
..message = json['message'] == null
? null
: Message.fromJson(json['message'] as Map<String, dynamic>);
RejectInviteResponse _$RejectInviteResponseFromJson(Map<String, dynamic> json) {
return RejectInviteResponse()
..duration = json['duration'] as String?
..channel = ChannelModel.fromJson(json['channel'] as Map<String, dynamic>)
..members = (json['members'] as List<dynamic>?)
?.map((e) => Member.fromJson(e as Map<String, dynamic>))
.toList() ??
[]
..message = json['message'] == null
? null
: Message.fromJson(json['message'] as Map<String, dynamic>);
}
RejectInviteResponse _$RejectInviteResponseFromJson(
Map<String, dynamic> json) =>
RejectInviteResponse()
..duration = json['duration'] as String?
..channel = ChannelModel.fromJson(json['channel'] as Map<String, dynamic>)
..members = (json['members'] as List<dynamic>?)
?.map((e) => Member.fromJson(e as Map<String, dynamic>))
.toList() ??
[]
..message = json['message'] == null
? null
: Message.fromJson(json['message'] as Map<String, dynamic>);
EmptyResponse _$EmptyResponseFromJson(Map<String, dynamic> json) {
return EmptyResponse()..duration = json['duration'] as String?;
}
EmptyResponse _$EmptyResponseFromJson(Map<String, dynamic> json) =>
EmptyResponse()..duration = json['duration'] as String?;
ChannelStateResponse _$ChannelStateResponseFromJson(Map<String, dynamic> json) {
return ChannelStateResponse()
..duration = json['duration'] as String?
..channel = ChannelModel.fromJson(json['channel'] as Map<String, dynamic>)
..messages = (json['messages'] as List<dynamic>?)
?.map((e) => Message.fromJson(e as Map<String, dynamic>))
.toList() ??
[]
..members = (json['members'] as List<dynamic>?)
?.map((e) => Member.fromJson(e as Map<String, dynamic>))
.toList() ??
[]
..watcherCount = json['watcher_count'] as int? ?? 0
..read = (json['read'] as List<dynamic>?)
?.map((e) => Read.fromJson(e as Map<String, dynamic>))
.toList() ??
[];
}
ChannelStateResponse _$ChannelStateResponseFromJson(
Map<String, dynamic> json) =>
ChannelStateResponse()
..duration = json['duration'] as String?
..channel = ChannelModel.fromJson(json['channel'] as Map<String, dynamic>)
..messages = (json['messages'] as List<dynamic>?)
?.map((e) => Message.fromJson(e as Map<String, dynamic>))
.toList() ??
[]
..members = (json['members'] as List<dynamic>?)
?.map((e) => Member.fromJson(e as Map<String, dynamic>))
.toList() ??
[]
..watcherCount = json['watcher_count'] as int? ?? 0
..read = (json['read'] as List<dynamic>?)
?.map((e) => Read.fromJson(e as Map<String, dynamic>))
.toList() ??
[];
@@ -21,7 +21,6 @@ class Action {
final String name;
/// The style of the action
@JsonKey(defaultValue: 'default')
final String style;
/// The test of the action
@@ -6,15 +6,13 @@ part of 'action.dart';
// JsonSerializableGenerator
// **************************************************************************
Action _$ActionFromJson(Map<String, dynamic> json) {
return Action(
name: json['name'] as String,
style: json['style'] as String? ?? 'default',
text: json['text'] as String,
type: json['type'] as String,
value: json['value'] as String?,
);
}
Action _$ActionFromJson(Map<String, dynamic> json) => Action(
name: json['name'] as String,
style: json['style'] as String? ?? 'default',
text: json['text'] as String,
type: json['type'] as String,
value: json['value'] as String?,
);
Map<String, dynamic> _$ActionToJson(Action instance) => <String, dynamic>{
'name': instance.name,
@@ -120,10 +120,7 @@ class Attachment extends Equatable {
late final UploadState uploadState;
/// Map of custom channel extraData
@JsonKey(
includeIfNull: false,
defaultValue: {},
)
@JsonKey(includeIfNull: false)
final Map<String, Object?> extraData;
/// The attachment ID.
@@ -6,39 +6,37 @@ part of 'attachment.dart';
// JsonSerializableGenerator
// **************************************************************************
Attachment _$AttachmentFromJson(Map<String, dynamic> json) {
return Attachment(
id: json['id'] as String?,
type: json['type'] as String?,
titleLink: json['title_link'] as String?,
title: json['title'] as String?,
thumbUrl: json['thumb_url'] as String?,
text: json['text'] as String?,
pretext: json['pretext'] as String?,
ogScrapeUrl: json['og_scrape_url'] as String?,
imageUrl: json['image_url'] as String?,
footerIcon: json['footer_icon'] as String?,
footer: json['footer'] as String?,
fields: json['fields'],
fallback: json['fallback'] as String?,
color: json['color'] as String?,
authorName: json['author_name'] as String?,
authorLink: json['author_link'] as String?,
authorIcon: json['author_icon'] as String?,
assetUrl: json['asset_url'] as String?,
actions: (json['actions'] as List<dynamic>?)
?.map((e) => Action.fromJson(e as Map<String, dynamic>))
.toList() ??
[],
extraData: json['extra_data'] as Map<String, dynamic>? ?? {},
file: json['file'] == null
? null
: AttachmentFile.fromJson(json['file'] as Map<String, dynamic>),
uploadState: json['upload_state'] == null
? null
: UploadState.fromJson(json['upload_state'] as Map<String, dynamic>),
);
}
Attachment _$AttachmentFromJson(Map<String, dynamic> json) => Attachment(
id: json['id'] as String?,
type: json['type'] as String?,
titleLink: json['title_link'] as String?,
title: json['title'] as String?,
thumbUrl: json['thumb_url'] as String?,
text: json['text'] as String?,
pretext: json['pretext'] as String?,
ogScrapeUrl: json['og_scrape_url'] as String?,
imageUrl: json['image_url'] as String?,
footerIcon: json['footer_icon'] as String?,
footer: json['footer'] as String?,
fields: json['fields'],
fallback: json['fallback'] as String?,
color: json['color'] as String?,
authorName: json['author_name'] as String?,
authorLink: json['author_link'] as String?,
authorIcon: json['author_icon'] as String?,
assetUrl: json['asset_url'] as String?,
actions: (json['actions'] as List<dynamic>?)
?.map((e) => Action.fromJson(e as Map<String, dynamic>))
.toList() ??
[],
extraData: json['extra_data'] as Map<String, dynamic>? ?? const {},
file: json['file'] == null
? null
: AttachmentFile.fromJson(json['file'] as Map<String, dynamic>),
uploadState: json['upload_state'] == null
? null
: UploadState.fromJson(json['upload_state'] as Map<String, dynamic>),
);
Map<String, dynamic> _$AttachmentToJson(Attachment instance) {
final val = <String, dynamic>{};
@@ -1,5 +1,6 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target
part of 'attachment_file.dart';
@@ -13,7 +14,7 @@ final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more informations: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
UploadState _$UploadStateFromJson(Map<String, dynamic> json) {
switch (json['runtimeType'] as String) {
switch (json['runtimeType'] as String?) {
case 'preparing':
return Preparing.fromJson(json);
case 'inProgress':
@@ -24,7 +25,8 @@ UploadState _$UploadStateFromJson(Map<String, dynamic> json) {
return Failed.fromJson(json);
default:
throw FallThroughError();
throw CheckedFromJsonException(json, 'runtimeType', 'UploadState',
'Invalid union type "${json['runtimeType']}"!');
}
}
@@ -72,6 +74,14 @@ mixin _$UploadState {
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? preparing,
TResult Function(int uploaded, int total)? inProgress,
TResult Function()? success,
TResult Function(String error)? failed,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function()? preparing,
TResult Function(int uploaded, int total)? inProgress,
@@ -89,6 +99,14 @@ mixin _$UploadState {
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Preparing value)? preparing,
TResult Function(InProgress value)? inProgress,
TResult Function(Success value)? success,
TResult Function(Failed value)? failed,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(Preparing value)? preparing,
TResult Function(InProgress value)? inProgress,
@@ -138,7 +156,7 @@ class _$Preparing implements Preparing {
const _$Preparing();
factory _$Preparing.fromJson(Map<String, dynamic> json) =>
_$_$PreparingFromJson(json);
_$$PreparingFromJson(json);
@override
String toString() {
@@ -164,6 +182,17 @@ class _$Preparing implements Preparing {
return preparing();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? preparing,
TResult Function(int uploaded, int total)? inProgress,
TResult Function()? success,
TResult Function(String error)? failed,
}) {
return preparing?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@@ -190,6 +219,17 @@ class _$Preparing implements Preparing {
return preparing(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Preparing value)? preparing,
TResult Function(InProgress value)? inProgress,
TResult Function(Success value)? success,
TResult Function(Failed value)? failed,
}) {
return preparing?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@@ -207,7 +247,7 @@ class _$Preparing implements Preparing {
@override
Map<String, dynamic> toJson() {
return _$_$PreparingToJson(this)..['runtimeType'] = 'preparing';
return _$$PreparingToJson(this)..['runtimeType'] = 'preparing';
}
}
@@ -258,7 +298,7 @@ class _$InProgress implements InProgress {
const _$InProgress({required this.uploaded, required this.total});
factory _$InProgress.fromJson(Map<String, dynamic> json) =>
_$_$InProgressFromJson(json);
_$$InProgressFromJson(json);
@override
final int uploaded;
@@ -303,6 +343,17 @@ class _$InProgress implements InProgress {
return inProgress(uploaded, total);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? preparing,
TResult Function(int uploaded, int total)? inProgress,
TResult Function()? success,
TResult Function(String error)? failed,
}) {
return inProgress?.call(uploaded, total);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@@ -329,6 +380,17 @@ class _$InProgress implements InProgress {
return inProgress(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Preparing value)? preparing,
TResult Function(InProgress value)? inProgress,
TResult Function(Success value)? success,
TResult Function(Failed value)? failed,
}) {
return inProgress?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@@ -346,7 +408,7 @@ class _$InProgress implements InProgress {
@override
Map<String, dynamic> toJson() {
return _$_$InProgressToJson(this)..['runtimeType'] = 'inProgress';
return _$$InProgressToJson(this)..['runtimeType'] = 'inProgress';
}
}
@@ -386,7 +448,7 @@ class _$Success implements Success {
const _$Success();
factory _$Success.fromJson(Map<String, dynamic> json) =>
_$_$SuccessFromJson(json);
_$$SuccessFromJson(json);
@override
String toString() {
@@ -412,6 +474,17 @@ class _$Success implements Success {
return success();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? preparing,
TResult Function(int uploaded, int total)? inProgress,
TResult Function()? success,
TResult Function(String error)? failed,
}) {
return success?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@@ -438,6 +511,17 @@ class _$Success implements Success {
return success(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Preparing value)? preparing,
TResult Function(InProgress value)? inProgress,
TResult Function(Success value)? success,
TResult Function(Failed value)? failed,
}) {
return success?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@@ -455,7 +539,7 @@ class _$Success implements Success {
@override
Map<String, dynamic> toJson() {
return _$_$SuccessToJson(this)..['runtimeType'] = 'success';
return _$$SuccessToJson(this)..['runtimeType'] = 'success';
}
}
@@ -500,7 +584,7 @@ class _$Failed implements Failed {
const _$Failed({required this.error});
factory _$Failed.fromJson(Map<String, dynamic> json) =>
_$_$FailedFromJson(json);
_$$FailedFromJson(json);
@override
final String error;
@@ -538,6 +622,17 @@ class _$Failed implements Failed {
return failed(error);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult Function()? preparing,
TResult Function(int uploaded, int total)? inProgress,
TResult Function()? success,
TResult Function(String error)? failed,
}) {
return failed?.call(error);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
@@ -564,6 +659,17 @@ class _$Failed implements Failed {
return failed(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult Function(Preparing value)? preparing,
TResult Function(InProgress value)? inProgress,
TResult Function(Success value)? success,
TResult Function(Failed value)? failed,
}) {
return failed?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
@@ -581,7 +687,7 @@ class _$Failed implements Failed {
@override
Map<String, dynamic> toJson() {
return _$_$FailedToJson(this)..['runtimeType'] = 'failed';
return _$$FailedToJson(this)..['runtimeType'] = 'failed';
}
}
@@ -6,14 +6,13 @@ part of 'attachment_file.dart';
// JsonSerializableGenerator
// **************************************************************************
AttachmentFile _$AttachmentFileFromJson(Map<String, dynamic> json) {
return AttachmentFile(
size: json['size'] as int?,
path: json['path'] as String?,
name: json['name'] as String?,
bytes: _fromString(json['bytes'] as String?),
);
}
AttachmentFile _$AttachmentFileFromJson(Map<String, dynamic> json) =>
AttachmentFile(
size: json['size'] as int?,
path: json['path'] as String?,
name: json['name'] as String?,
bytes: _fromString(json['bytes'] as String?),
);
Map<String, dynamic> _$AttachmentFileToJson(AttachmentFile instance) =>
<String, dynamic>{
@@ -23,39 +22,31 @@ Map<String, dynamic> _$AttachmentFileToJson(AttachmentFile instance) =>
'size': instance.size,
};
_$Preparing _$_$PreparingFromJson(Map<String, dynamic> json) {
return _$Preparing();
}
_$Preparing _$$PreparingFromJson(Map<String, dynamic> json) => _$Preparing();
Map<String, dynamic> _$_$PreparingToJson(_$Preparing instance) =>
Map<String, dynamic> _$$PreparingToJson(_$Preparing instance) =>
<String, dynamic>{};
_$InProgress _$_$InProgressFromJson(Map<String, dynamic> json) {
return _$InProgress(
uploaded: json['uploaded'] as int,
total: json['total'] as int,
);
}
_$InProgress _$$InProgressFromJson(Map<String, dynamic> json) => _$InProgress(
uploaded: json['uploaded'] as int,
total: json['total'] as int,
);
Map<String, dynamic> _$_$InProgressToJson(_$InProgress instance) =>
Map<String, dynamic> _$$InProgressToJson(_$InProgress instance) =>
<String, dynamic>{
'uploaded': instance.uploaded,
'total': instance.total,
};
_$Success _$_$SuccessFromJson(Map<String, dynamic> json) {
return _$Success();
}
_$Success _$$SuccessFromJson(Map<String, dynamic> json) => _$Success();
Map<String, dynamic> _$_$SuccessToJson(_$Success instance) =>
Map<String, dynamic> _$$SuccessToJson(_$Success instance) =>
<String, dynamic>{};
_$Failed _$_$FailedFromJson(Map<String, dynamic> json) {
return _$Failed(
error: json['error'] as String,
);
}
_$Failed _$$FailedFromJson(Map<String, dynamic> json) => _$Failed(
error: json['error'] as String,
);
Map<String, dynamic> _$_$FailedToJson(_$Failed instance) => <String, dynamic>{
Map<String, dynamic> _$$FailedToJson(_$Failed instance) => <String, dynamic>{
'error': instance.error,
};
@@ -31,15 +31,12 @@ class ChannelConfig {
_$ChannelConfigFromJson(json);
/// Moderation configuration
@JsonKey(defaultValue: 'flag')
final String automod;
/// List of available commands
@JsonKey(defaultValue: [])
final List<Command> commands;
/// True if the channel should send connect events
@JsonKey(defaultValue: false)
final bool connectEvents;
/// Date of channel creation
@@ -49,43 +46,33 @@ class ChannelConfig {
final DateTime updatedAt;
/// Max channel message length
@JsonKey(defaultValue: 0)
final int maxMessageLength;
/// Duration of message retention
@JsonKey(defaultValue: '')
final String messageRetention;
/// True if users can be muted
@JsonKey(defaultValue: false)
final bool mutes;
/// True if reaction are active for this channel
@JsonKey(defaultValue: false)
final bool reactions;
/// True if readEvents are active for this channel
@JsonKey(defaultValue: false)
final bool readEvents;
/// True if reply message are active for this channel
@JsonKey(defaultValue: false)
final bool replies;
/// True if it's possible to perform a search in this channel
@JsonKey(defaultValue: false)
final bool search;
/// True if typing events should be sent for this channel
@JsonKey(defaultValue: false)
final bool typingEvents;
/// True if it's possible to upload files to this channel
@JsonKey(defaultValue: false)
final bool uploads;
/// True if urls appears as attachments
@JsonKey(defaultValue: false)
final bool urlEnrichment;
/// Serialize to json
@@ -6,32 +6,31 @@ part of 'channel_config.dart';
// JsonSerializableGenerator
// **************************************************************************
ChannelConfig _$ChannelConfigFromJson(Map<String, dynamic> json) {
return ChannelConfig(
automod: json['automod'] as String? ?? 'flag',
commands: (json['commands'] as List<dynamic>?)
?.map((e) => Command.fromJson(e as Map<String, dynamic>))
.toList() ??
[],
connectEvents: json['connect_events'] as bool? ?? false,
createdAt: json['created_at'] == null
? null
: DateTime.parse(json['created_at'] as String),
updatedAt: json['updated_at'] == null
? null
: DateTime.parse(json['updated_at'] as String),
maxMessageLength: json['max_message_length'] as int? ?? 0,
messageRetention: json['message_retention'] as String? ?? '',
mutes: json['mutes'] as bool? ?? false,
reactions: json['reactions'] as bool? ?? false,
readEvents: json['read_events'] as bool? ?? false,
replies: json['replies'] as bool? ?? false,
search: json['search'] as bool? ?? false,
typingEvents: json['typing_events'] as bool? ?? false,
uploads: json['uploads'] as bool? ?? false,
urlEnrichment: json['url_enrichment'] as bool? ?? false,
);
}
ChannelConfig _$ChannelConfigFromJson(Map<String, dynamic> json) =>
ChannelConfig(
automod: json['automod'] as String? ?? 'flag',
commands: (json['commands'] as List<dynamic>?)
?.map((e) => Command.fromJson(e as Map<String, dynamic>))
.toList() ??
const [],
connectEvents: json['connect_events'] as bool? ?? false,
createdAt: json['created_at'] == null
? null
: DateTime.parse(json['created_at'] as String),
updatedAt: json['updated_at'] == null
? null
: DateTime.parse(json['updated_at'] as String),
maxMessageLength: json['max_message_length'] as int? ?? 0,
messageRetention: json['message_retention'] as String? ?? '',
mutes: json['mutes'] as bool? ?? false,
reactions: json['reactions'] as bool? ?? false,
readEvents: json['read_events'] as bool? ?? false,
replies: json['replies'] as bool? ?? false,
search: json['search'] as bool? ?? false,
typingEvents: json['typing_events'] as bool? ?? false,
uploads: json['uploads'] as bool? ?? false,
urlEnrichment: json['url_enrichment'] as bool? ?? false,
);
Map<String, dynamic> _$ChannelConfigToJson(ChannelConfig instance) =>
<String, dynamic>{
@@ -60,7 +60,7 @@ class ChannelModel {
final User? createdBy;
/// True if this channel is frozen
@JsonKey(includeIfNull: false, defaultValue: false)
@JsonKey(includeIfNull: false)
final bool frozen;
/// The date of the last message
@@ -80,18 +80,15 @@ class ChannelModel {
final DateTime? deletedAt;
/// The count of this channel members
@JsonKey(includeIfNull: false, toJson: Serializer.readOnly, defaultValue: 0)
@JsonKey(includeIfNull: false, toJson: Serializer.readOnly)
final int memberCount;
/// The number of seconds in a cooldown
@JsonKey(includeIfNull: false, defaultValue: 0)
@JsonKey(includeIfNull: false)
final int cooldown;
/// Map of custom channel extraData
@JsonKey(
includeIfNull: false,
defaultValue: {},
)
@JsonKey(includeIfNull: false)
final Map<String, Object?> extraData;
/// The team the channel belongs to
@@ -6,36 +6,34 @@ part of 'channel_model.dart';
// JsonSerializableGenerator
// **************************************************************************
ChannelModel _$ChannelModelFromJson(Map<String, dynamic> json) {
return ChannelModel(
id: json['id'] as String?,
type: json['type'] as String?,
cid: json['cid'] as String?,
config: json['config'] == null
? null
: ChannelConfig.fromJson(json['config'] as Map<String, dynamic>),
createdBy: json['created_by'] == null
? null
: User.fromJson(json['created_by'] as Map<String, dynamic>),
frozen: json['frozen'] as bool? ?? false,
lastMessageAt: json['last_message_at'] == null
? null
: DateTime.parse(json['last_message_at'] as String),
createdAt: json['created_at'] == null
? null
: DateTime.parse(json['created_at'] as String),
updatedAt: json['updated_at'] == null
? null
: DateTime.parse(json['updated_at'] as String),
deletedAt: json['deleted_at'] == null
? null
: DateTime.parse(json['deleted_at'] as String),
memberCount: json['member_count'] as int? ?? 0,
extraData: json['extra_data'] as Map<String, dynamic>? ?? {},
team: json['team'] as String?,
cooldown: json['cooldown'] as int? ?? 0,
);
}
ChannelModel _$ChannelModelFromJson(Map<String, dynamic> json) => ChannelModel(
id: json['id'] as String?,
type: json['type'] as String?,
cid: json['cid'] as String?,
config: json['config'] == null
? null
: ChannelConfig.fromJson(json['config'] as Map<String, dynamic>),
createdBy: json['created_by'] == null
? null
: User.fromJson(json['created_by'] as Map<String, dynamic>),
frozen: json['frozen'] as bool? ?? false,
lastMessageAt: json['last_message_at'] == null
? null
: DateTime.parse(json['last_message_at'] as String),
createdAt: json['created_at'] == null
? null
: DateTime.parse(json['created_at'] as String),
updatedAt: json['updated_at'] == null
? null
: DateTime.parse(json['updated_at'] as String),
deletedAt: json['deleted_at'] == null
? null
: DateTime.parse(json['deleted_at'] as String),
memberCount: json['member_count'] as int? ?? 0,
extraData: json['extra_data'] as Map<String, dynamic>? ?? const {},
team: json['team'] as String?,
cooldown: json['cooldown'] as int? ?? 0,
);
Map<String, dynamic> _$ChannelModelToJson(ChannelModel instance) {
final val = <String, dynamic>{
@@ -25,26 +25,21 @@ class ChannelState {
final ChannelModel? channel;
/// A paginated list of channel messages
@JsonKey(defaultValue: <Message>[])
final List<Message> messages;
/// A paginated list of channel members
@JsonKey(defaultValue: <Member>[])
final List<Member> members;
/// A paginated list of pinned messages
@JsonKey(defaultValue: <Message>[])
final List<Message> pinnedMessages;
/// The count of users watching the channel
final int? watcherCount;
/// A paginated list of users watching the channel
@JsonKey(defaultValue: <User>[])
final List<User> watchers;
/// The list of channel reads
@JsonKey(defaultValue: <Read>[])
final List<Read> read;
/// Create a new instance from a json
@@ -6,34 +6,32 @@ part of 'channel_state.dart';
// JsonSerializableGenerator
// **************************************************************************
ChannelState _$ChannelStateFromJson(Map<String, dynamic> json) {
return ChannelState(
channel: json['channel'] == null
? null
: ChannelModel.fromJson(json['channel'] as Map<String, dynamic>),
messages: (json['messages'] as List<dynamic>?)
?.map((e) => Message.fromJson(e as Map<String, dynamic>))
.toList() ??
[],
members: (json['members'] as List<dynamic>?)
?.map((e) => Member.fromJson(e as Map<String, dynamic>))
.toList() ??
[],
pinnedMessages: (json['pinned_messages'] as List<dynamic>?)
?.map((e) => Message.fromJson(e as Map<String, dynamic>))
.toList() ??
[],
watcherCount: json['watcher_count'] as int?,
watchers: (json['watchers'] as List<dynamic>?)
?.map((e) => User.fromJson(e as Map<String, dynamic>))
.toList() ??
[],
read: (json['read'] as List<dynamic>?)
?.map((e) => Read.fromJson(e as Map<String, dynamic>))
.toList() ??
[],
);
}
ChannelState _$ChannelStateFromJson(Map<String, dynamic> json) => ChannelState(
channel: json['channel'] == null
? null
: ChannelModel.fromJson(json['channel'] as Map<String, dynamic>),
messages: (json['messages'] as List<dynamic>?)
?.map((e) => Message.fromJson(e as Map<String, dynamic>))
.toList() ??
const [],
members: (json['members'] as List<dynamic>?)
?.map((e) => Member.fromJson(e as Map<String, dynamic>))
.toList() ??
const [],
pinnedMessages: (json['pinned_messages'] as List<dynamic>?)
?.map((e) => Message.fromJson(e as Map<String, dynamic>))
.toList() ??
const [],
watcherCount: json['watcher_count'] as int?,
watchers: (json['watchers'] as List<dynamic>?)
?.map((e) => User.fromJson(e as Map<String, dynamic>))
.toList() ??
const [],
read: (json['read'] as List<dynamic>?)
?.map((e) => Read.fromJson(e as Map<String, dynamic>))
.toList() ??
const [],
);
Map<String, dynamic> _$ChannelStateToJson(ChannelState instance) =>
<String, dynamic>{
@@ -6,13 +6,11 @@ part of 'command.dart';
// JsonSerializableGenerator
// **************************************************************************
Command _$CommandFromJson(Map<String, dynamic> json) {
return Command(
name: json['name'] as String,
description: json['description'] as String,
args: json['args'] as String,
);
}
Command _$CommandFromJson(Map<String, dynamic> json) => Command(
name: json['name'] as String,
description: json['description'] as String,
args: json['args'] as String,
);
Map<String, dynamic> _$CommandToJson(Command instance) => <String, dynamic>{
'name': instance.name,
@@ -6,12 +6,10 @@ part of 'device.dart';
// JsonSerializableGenerator
// **************************************************************************
Device _$DeviceFromJson(Map<String, dynamic> json) {
return Device(
id: json['id'] as String,
pushProvider: json['push_provider'] as String,
);
}
Device _$DeviceFromJson(Map<String, dynamic> json) => Device(
id: json['id'] as String,
pushProvider: json['push_provider'] as String,
);
Map<String, dynamic> _$DeviceToJson(Device instance) => <String, dynamic>{
'id': instance.id,
@@ -92,7 +92,6 @@ class Event {
final bool isLocal;
/// Map of custom channel extraData
@JsonKey(defaultValue: {})
final Map<String, Object?> extraData;
/// Known top level fields.
@@ -184,7 +183,7 @@ class EventChannel extends ChannelModel {
DateTime? deletedAt,
required int memberCount,
Map<String, Object?>? extraData,
required int cooldown,
int cooldown = 0,
String? team,
}) : super(
id: id,
@@ -6,42 +6,40 @@ part of 'event.dart';
// JsonSerializableGenerator
// **************************************************************************
Event _$EventFromJson(Map<String, dynamic> json) {
return Event(
type: json['type'] as String,
cid: json['cid'] as String?,
connectionId: json['connection_id'] as String?,
createdAt: json['created_at'] == null
? null
: DateTime.parse(json['created_at'] as String),
me: json['me'] == null
? null
: OwnUser.fromJson(json['me'] as Map<String, dynamic>),
user: json['user'] == null
? null
: User.fromJson(json['user'] as Map<String, dynamic>),
message: json['message'] == null
? null
: Message.fromJson(json['message'] as Map<String, dynamic>),
totalUnreadCount: json['total_unread_count'] as int?,
unreadChannels: json['unread_channels'] as int?,
reaction: json['reaction'] == null
? null
: Reaction.fromJson(json['reaction'] as Map<String, dynamic>),
online: json['online'] as bool?,
channel: json['channel'] == null
? null
: EventChannel.fromJson(json['channel'] as Map<String, dynamic>),
member: json['member'] == null
? null
: Member.fromJson(json['member'] as Map<String, dynamic>),
channelId: json['channel_id'] as String?,
channelType: json['channel_type'] as String?,
parentId: json['parent_id'] as String?,
extraData: json['extra_data'] as Map<String, dynamic>? ?? {},
isLocal: json['is_local'] as bool? ?? false,
);
}
Event _$EventFromJson(Map<String, dynamic> json) => Event(
type: json['type'] as String? ?? 'local.event',
cid: json['cid'] as String?,
connectionId: json['connection_id'] as String?,
createdAt: json['created_at'] == null
? null
: DateTime.parse(json['created_at'] as String),
me: json['me'] == null
? null
: OwnUser.fromJson(json['me'] as Map<String, dynamic>),
user: json['user'] == null
? null
: User.fromJson(json['user'] as Map<String, dynamic>),
message: json['message'] == null
? null
: Message.fromJson(json['message'] as Map<String, dynamic>),
totalUnreadCount: json['total_unread_count'] as int?,
unreadChannels: json['unread_channels'] as int?,
reaction: json['reaction'] == null
? null
: Reaction.fromJson(json['reaction'] as Map<String, dynamic>),
online: json['online'] as bool?,
channel: json['channel'] == null
? null
: EventChannel.fromJson(json['channel'] as Map<String, dynamic>),
member: json['member'] == null
? null
: Member.fromJson(json['member'] as Map<String, dynamic>),
channelId: json['channel_id'] as String?,
channelType: json['channel_type'] as String?,
parentId: json['parent_id'] as String?,
extraData: json['extra_data'] as Map<String, dynamic>? ?? const {},
isLocal: json['is_local'] as bool? ?? false,
);
Map<String, dynamic> _$EventToJson(Event instance) => <String, dynamic>{
'type': instance.type,
@@ -64,30 +62,28 @@ Map<String, dynamic> _$EventToJson(Event instance) => <String, dynamic>{
'extra_data': instance.extraData,
};
EventChannel _$EventChannelFromJson(Map<String, dynamic> json) {
return EventChannel(
members: (json['members'] as List<dynamic>?)
?.map((e) => Member.fromJson(e as Map<String, dynamic>))
.toList(),
id: json['id'] as String?,
type: json['type'] as String?,
cid: json['cid'] as String,
config: ChannelConfig.fromJson(json['config'] as Map<String, dynamic>),
createdBy: json['created_by'] == null
? null
: User.fromJson(json['created_by'] as Map<String, dynamic>),
frozen: json['frozen'] as bool? ?? false,
lastMessageAt: json['last_message_at'] == null
? null
: DateTime.parse(json['last_message_at'] as String),
createdAt: DateTime.parse(json['created_at'] as String),
updatedAt: DateTime.parse(json['updated_at'] as String),
deletedAt: json['deleted_at'] == null
? null
: DateTime.parse(json['deleted_at'] as String),
memberCount: json['member_count'] as int? ?? 0,
extraData: json['extra_data'] as Map<String, dynamic>? ?? {},
cooldown: json['cooldown'] as int? ?? 0,
team: json['team'] as String?,
);
}
EventChannel _$EventChannelFromJson(Map<String, dynamic> json) => EventChannel(
members: (json['members'] as List<dynamic>?)
?.map((e) => Member.fromJson(e as Map<String, dynamic>))
.toList(),
id: json['id'] as String?,
type: json['type'] as String?,
cid: json['cid'] as String,
config: ChannelConfig.fromJson(json['config'] as Map<String, dynamic>),
createdBy: json['created_by'] == null
? null
: User.fromJson(json['created_by'] as Map<String, dynamic>),
frozen: json['frozen'] as bool? ?? false,
lastMessageAt: json['last_message_at'] == null
? null
: DateTime.parse(json['last_message_at'] as String),
createdAt: DateTime.parse(json['created_at'] as String),
updatedAt: DateTime.parse(json['updated_at'] as String),
deletedAt: json['deleted_at'] == null
? null
: DateTime.parse(json['deleted_at'] as String),
memberCount: json['member_count'] as int,
extraData: json['extra_data'] as Map<String, dynamic>?,
cooldown: json['cooldown'] as int? ?? 0,
team: json['team'] as String?,
);
@@ -42,7 +42,6 @@ class Member extends Equatable {
final DateTime? inviteRejectedAt;
/// True if the user has been invited to the channel
@JsonKey(defaultValue: false)
final bool invited;
/// The role of the user in the channel
@@ -52,15 +51,12 @@ class Member extends Equatable {
final String? userId;
/// True if the user is a moderator of the channel
@JsonKey(defaultValue: false)
final bool isModerator;
/// True if the member is banned from the channel
@JsonKey(defaultValue: false)
final bool banned;
/// True if the member is shadow banned from the channel
@JsonKey(defaultValue: false)
final bool shadowBanned;
/// The date of creation
@@ -6,31 +6,29 @@ part of 'member.dart';
// JsonSerializableGenerator
// **************************************************************************
Member _$MemberFromJson(Map<String, dynamic> json) {
return Member(
user: json['user'] == null
? null
: User.fromJson(json['user'] as Map<String, dynamic>),
inviteAcceptedAt: json['invite_accepted_at'] == null
? null
: DateTime.parse(json['invite_accepted_at'] as String),
inviteRejectedAt: json['invite_rejected_at'] == null
? null
: DateTime.parse(json['invite_rejected_at'] as String),
invited: json['invited'] as bool? ?? false,
role: json['role'] as String?,
userId: json['user_id'] as String?,
isModerator: json['is_moderator'] as bool? ?? false,
createdAt: json['created_at'] == null
? null
: DateTime.parse(json['created_at'] as String),
updatedAt: json['updated_at'] == null
? null
: DateTime.parse(json['updated_at'] as String),
banned: json['banned'] as bool? ?? false,
shadowBanned: json['shadow_banned'] as bool? ?? false,
);
}
Member _$MemberFromJson(Map<String, dynamic> json) => Member(
user: json['user'] == null
? null
: User.fromJson(json['user'] as Map<String, dynamic>),
inviteAcceptedAt: json['invite_accepted_at'] == null
? null
: DateTime.parse(json['invite_accepted_at'] as String),
inviteRejectedAt: json['invite_rejected_at'] == null
? null
: DateTime.parse(json['invite_rejected_at'] as String),
invited: json['invited'] as bool? ?? false,
role: json['role'] as String?,
userId: json['user_id'] as String?,
isModerator: json['is_moderator'] as bool? ?? false,
createdAt: json['created_at'] == null
? null
: DateTime.parse(json['created_at'] as String),
updatedAt: json['updated_at'] == null
? null
: DateTime.parse(json['updated_at'] as String),
banned: json['banned'] as bool? ?? false,
shadowBanned: json['shadow_banned'] as bool? ?? false,
);
Map<String, dynamic> _$MemberToJson(Member instance) => <String, dynamic>{
'user': instance.user?.toJson(),
@@ -99,23 +99,16 @@ class Message extends Equatable {
@JsonKey(
includeIfNull: false,
toJson: Serializer.readOnly,
defaultValue: 'regular',
)
final String type;
/// The list of attachments, either provided by the user or generated from a
/// command or as a result of URL scraping.
@JsonKey(
includeIfNull: false,
defaultValue: [],
)
@JsonKey(includeIfNull: false)
final List<Attachment> attachments;
/// The list of user mentioned in the message
@JsonKey(
toJson: User.toIds,
defaultValue: [],
)
@JsonKey(toJson: User.toIds)
final List<User> mentionedUsers;
/// A map describing the count of number of every reaction
@@ -156,14 +149,12 @@ class Message extends Equatable {
final bool? showInChannel;
/// If true the message is silent
@JsonKey(defaultValue: false)
final bool silent;
/// If true the message is shadowed
@JsonKey(
includeIfNull: false,
toJson: Serializer.readOnly,
defaultValue: false,
)
final bool shadowed;
@@ -184,7 +175,6 @@ class Message extends Equatable {
final User? user;
/// If true the message is pinned
@JsonKey(defaultValue: false)
final bool pinned;
/// Reserved field indicating when the message was pinned
@@ -201,10 +191,7 @@ class Message extends Equatable {
final User? pinnedBy;
/// Message custom extraData
@JsonKey(
includeIfNull: false,
defaultValue: {},
)
@JsonKey(includeIfNull: false)
final Map<String, Object?> extraData;
/// True if the message is a system info
@@ -6,72 +6,70 @@ part of 'message.dart';
// JsonSerializableGenerator
// **************************************************************************
Message _$MessageFromJson(Map<String, dynamic> json) {
return Message(
id: json['id'] as String?,
text: json['text'] as String?,
type: json['type'] as String? ?? 'regular',
attachments: (json['attachments'] as List<dynamic>?)
?.map((e) => Attachment.fromJson(e as Map<String, dynamic>))
.toList() ??
[],
mentionedUsers: (json['mentioned_users'] as List<dynamic>?)
?.map((e) => User.fromJson(e as Map<String, dynamic>))
.toList() ??
[],
silent: json['silent'] as bool? ?? false,
shadowed: json['shadowed'] as bool? ?? false,
reactionCounts: (json['reaction_counts'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as int),
),
reactionScores: (json['reaction_scores'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as int),
),
latestReactions: (json['latest_reactions'] as List<dynamic>?)
?.map((e) => Reaction.fromJson(e as Map<String, dynamic>))
.toList(),
ownReactions: (json['own_reactions'] as List<dynamic>?)
?.map((e) => Reaction.fromJson(e as Map<String, dynamic>))
.toList(),
parentId: json['parent_id'] as String?,
quotedMessage: json['quoted_message'] == null
? null
: Message.fromJson(json['quoted_message'] as Map<String, dynamic>),
quotedMessageId: json['quoted_message_id'] as String?,
replyCount: json['reply_count'] as int?,
threadParticipants: (json['thread_participants'] as List<dynamic>?)
?.map((e) => User.fromJson(e as Map<String, dynamic>))
.toList(),
showInChannel: json['show_in_channel'] as bool?,
command: json['command'] as String?,
createdAt: json['created_at'] == null
? null
: DateTime.parse(json['created_at'] as String),
updatedAt: json['updated_at'] == null
? null
: DateTime.parse(json['updated_at'] as String),
user: json['user'] == null
? null
: User.fromJson(json['user'] as Map<String, dynamic>),
pinned: json['pinned'] as bool? ?? false,
pinnedAt: json['pinned_at'] == null
? null
: DateTime.parse(json['pinned_at'] as String),
pinExpires: json['pin_expires'] == null
? null
: DateTime.parse(json['pin_expires'] as String),
pinnedBy: json['pinned_by'] == null
? null
: User.fromJson(json['pinned_by'] as Map<String, dynamic>),
extraData: json['extra_data'] as Map<String, dynamic>? ?? {},
deletedAt: json['deleted_at'] == null
? null
: DateTime.parse(json['deleted_at'] as String),
i18n: (json['i18n'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as String),
),
);
}
Message _$MessageFromJson(Map<String, dynamic> json) => Message(
id: json['id'] as String?,
text: json['text'] as String?,
type: json['type'] as String? ?? 'regular',
attachments: (json['attachments'] as List<dynamic>?)
?.map((e) => Attachment.fromJson(e as Map<String, dynamic>))
.toList() ??
const [],
mentionedUsers: (json['mentioned_users'] as List<dynamic>?)
?.map((e) => User.fromJson(e as Map<String, dynamic>))
.toList() ??
const [],
silent: json['silent'] as bool? ?? false,
shadowed: json['shadowed'] as bool? ?? false,
reactionCounts: (json['reaction_counts'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as int),
),
reactionScores: (json['reaction_scores'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as int),
),
latestReactions: (json['latest_reactions'] as List<dynamic>?)
?.map((e) => Reaction.fromJson(e as Map<String, dynamic>))
.toList(),
ownReactions: (json['own_reactions'] as List<dynamic>?)
?.map((e) => Reaction.fromJson(e as Map<String, dynamic>))
.toList(),
parentId: json['parent_id'] as String?,
quotedMessage: json['quoted_message'] == null
? null
: Message.fromJson(json['quoted_message'] as Map<String, dynamic>),
quotedMessageId: json['quoted_message_id'] as String?,
replyCount: json['reply_count'] as int? ?? 0,
threadParticipants: (json['thread_participants'] as List<dynamic>?)
?.map((e) => User.fromJson(e as Map<String, dynamic>))
.toList(),
showInChannel: json['show_in_channel'] as bool?,
command: json['command'] as String?,
createdAt: json['created_at'] == null
? null
: DateTime.parse(json['created_at'] as String),
updatedAt: json['updated_at'] == null
? null
: DateTime.parse(json['updated_at'] as String),
user: json['user'] == null
? null
: User.fromJson(json['user'] as Map<String, dynamic>),
pinned: json['pinned'] as bool? ?? false,
pinnedAt: json['pinned_at'] == null
? null
: DateTime.parse(json['pinned_at'] as String),
pinExpires: json['pin_expires'] == null
? null
: DateTime.parse(json['pin_expires'] as String),
pinnedBy: json['pinned_by'] == null
? null
: User.fromJson(json['pinned_by'] as Map<String, dynamic>),
extraData: json['extra_data'] as Map<String, dynamic>? ?? const {},
deletedAt: json['deleted_at'] == null
? null
: DateTime.parse(json['deleted_at'] as String),
i18n: (json['i18n'] as Map<String, dynamic>?)?.map(
(k, e) => MapEntry(k, e as String),
),
);
Map<String, dynamic> _$MessageToJson(Message instance) {
final val = <String, dynamic>{
@@ -6,11 +6,9 @@ part of 'mute.dart';
// JsonSerializableGenerator
// **************************************************************************
Mute _$MuteFromJson(Map<String, dynamic> json) {
return Mute(
user: User.fromJson(json['user'] as Map<String, dynamic>),
channel: ChannelModel.fromJson(json['channel'] as Map<String, dynamic>),
createdAt: DateTime.parse(json['created_at'] as String),
updatedAt: DateTime.parse(json['updated_at'] as String),
);
}
Mute _$MuteFromJson(Map<String, dynamic> json) => Mute(
user: User.fromJson(json['user'] as Map<String, dynamic>),
channel: ChannelModel.fromJson(json['channel'] as Map<String, dynamic>),
createdAt: DateTime.parse(json['created_at'] as String),
updatedAt: DateTime.parse(json['updated_at'] as String),
);
@@ -132,23 +132,23 @@ class OwnUser extends User {
}
/// List of user devices.
@JsonKey(includeIfNull: false, defaultValue: <Device>[])
@JsonKey(includeIfNull: false)
final List<Device> devices;
/// List of users muted by the user.
@JsonKey(includeIfNull: false, defaultValue: <Mute>[])
@JsonKey(includeIfNull: false)
final List<Mute> mutes;
/// List of users muted by the user.
@JsonKey(includeIfNull: false, defaultValue: <Mute>[])
@JsonKey(includeIfNull: false)
final List<Mute> channelMutes;
/// Total unread messages by the user.
@JsonKey(includeIfNull: false, defaultValue: 0)
@JsonKey(includeIfNull: false)
final int totalUnreadCount;
/// Total unread channels by the user.
@JsonKey(includeIfNull: false, defaultValue: 0)
@JsonKey(includeIfNull: false)
final int unreadChannels;
/// Known top level fields.
@@ -6,39 +6,37 @@ part of 'own_user.dart';
// JsonSerializableGenerator
// **************************************************************************
OwnUser _$OwnUserFromJson(Map<String, dynamic> json) {
return OwnUser(
devices: (json['devices'] as List<dynamic>?)
?.map((e) => Device.fromJson(e as Map<String, dynamic>))
.toList() ??
[],
mutes: (json['mutes'] as List<dynamic>?)
?.map((e) => Mute.fromJson(e as Map<String, dynamic>))
.toList() ??
[],
totalUnreadCount: json['total_unread_count'] as int? ?? 0,
unreadChannels: json['unread_channels'] as int? ?? 0,
channelMutes: (json['channel_mutes'] as List<dynamic>?)
?.map((e) => Mute.fromJson(e as Map<String, dynamic>))
.toList() ??
[],
id: json['id'] as String,
role: json['role'] as String?,
createdAt: json['created_at'] == null
? null
: DateTime.parse(json['created_at'] as String),
updatedAt: json['updated_at'] == null
? null
: DateTime.parse(json['updated_at'] as String),
lastActive: json['last_active'] == null
? null
: DateTime.parse(json['last_active'] as String),
online: json['online'] as bool? ?? false,
extraData: json['extra_data'] as Map<String, dynamic>? ?? {},
banned: json['banned'] as bool? ?? false,
teams:
(json['teams'] as List<dynamic>?)?.map((e) => e as String).toList() ??
[],
language: json['language'] as String?,
);
}
OwnUser _$OwnUserFromJson(Map<String, dynamic> json) => OwnUser(
devices: (json['devices'] as List<dynamic>?)
?.map((e) => Device.fromJson(e as Map<String, dynamic>))
.toList() ??
const [],
mutes: (json['mutes'] as List<dynamic>?)
?.map((e) => Mute.fromJson(e as Map<String, dynamic>))
.toList() ??
const [],
totalUnreadCount: json['total_unread_count'] as int? ?? 0,
unreadChannels: json['unread_channels'] as int? ?? 0,
channelMutes: (json['channel_mutes'] as List<dynamic>?)
?.map((e) => Mute.fromJson(e as Map<String, dynamic>))
.toList() ??
const [],
id: json['id'] as String,
role: json['role'] as String?,
createdAt: json['created_at'] == null
? null
: DateTime.parse(json['created_at'] as String),
updatedAt: json['updated_at'] == null
? null
: DateTime.parse(json['updated_at'] as String),
lastActive: json['last_active'] == null
? null
: DateTime.parse(json['last_active'] as String),
online: json['online'] as bool? ?? false,
extraData: json['extra_data'] as Map<String, dynamic>? ?? const {},
banned: json['banned'] as bool? ?? false,
teams:
(json['teams'] as List<dynamic>?)?.map((e) => e as String).toList() ??
const [],
language: json['language'] as String?,
);
@@ -41,7 +41,6 @@ class Reaction {
final User? user;
/// The score of the reaction (ie. number of reactions sent)
@JsonKey(defaultValue: 0)
final int score;
/// The userId that sent the reaction
@@ -49,10 +48,7 @@ class Reaction {
final String? userId;
/// Reaction custom extraData
@JsonKey(
includeIfNull: false,
defaultValue: {},
)
@JsonKey(includeIfNull: false)
final Map<String, Object?> extraData;
/// Map of custom user extraData
@@ -6,21 +6,19 @@ part of 'reaction.dart';
// JsonSerializableGenerator
// **************************************************************************
Reaction _$ReactionFromJson(Map<String, dynamic> json) {
return Reaction(
messageId: json['message_id'] as String?,
createdAt: json['created_at'] == null
? null
: DateTime.parse(json['created_at'] as String),
type: json['type'] as String,
user: json['user'] == null
? null
: User.fromJson(json['user'] as Map<String, dynamic>),
userId: json['user_id'] as String?,
score: json['score'] as int? ?? 0,
extraData: json['extra_data'] as Map<String, dynamic>? ?? {},
);
}
Reaction _$ReactionFromJson(Map<String, dynamic> json) => Reaction(
messageId: json['message_id'] as String?,
createdAt: json['created_at'] == null
? null
: DateTime.parse(json['created_at'] as String),
type: json['type'] as String,
user: json['user'] == null
? null
: User.fromJson(json['user'] as Map<String, dynamic>),
userId: json['user_id'] as String?,
score: json['score'] as int? ?? 0,
extraData: json['extra_data'] as Map<String, dynamic>? ?? const {},
);
Map<String, dynamic> _$ReactionToJson(Reaction instance) {
final val = <String, dynamic>{
@@ -23,7 +23,6 @@ class Read {
final User user;
/// Number of unread messages
@JsonKey(defaultValue: 0)
final int unreadMessages;
/// Serialize to json
@@ -6,13 +6,11 @@ part of 'read.dart';
// JsonSerializableGenerator
// **************************************************************************
Read _$ReadFromJson(Map<String, dynamic> json) {
return Read(
lastRead: DateTime.parse(json['last_read'] as String),
user: User.fromJson(json['user'] as Map<String, dynamic>),
unreadMessages: json['unread_messages'] as int? ?? 0,
);
}
Read _$ReadFromJson(Map<String, dynamic> json) => Read(
lastRead: DateTime.parse(json['last_read'] as String),
user: User.fromJson(json['user'] as Map<String, dynamic>),
unreadMessages: json['unread_messages'] as int? ?? 0,
);
Map<String, dynamic> _$ReadToJson(Read instance) => <String, dynamic>{
'last_read': instance.lastRead.toIso8601String(),
@@ -100,7 +100,6 @@ class User extends Equatable {
@JsonKey(
includeIfNull: false,
toJson: Serializer.readOnly,
defaultValue: <String>[],
)
final List<String> teams;
@@ -120,7 +119,6 @@ class User extends Equatable {
@JsonKey(
includeIfNull: false,
toJson: Serializer.readOnly,
defaultValue: false,
)
final bool online;
@@ -128,15 +126,11 @@ class User extends Equatable {
@JsonKey(
includeIfNull: false,
toJson: Serializer.readOnly,
defaultValue: false,
)
final bool banned;
/// Map of custom user extraData.
@JsonKey(
includeIfNull: false,
defaultValue: {},
)
@JsonKey(includeIfNull: false)
final Map<String, Object?> extraData;
/// The language this user prefers.
@@ -6,28 +6,26 @@ part of 'user.dart';
// JsonSerializableGenerator
// **************************************************************************
User _$UserFromJson(Map<String, dynamic> json) {
return User(
id: json['id'] as String,
role: json['role'] as String?,
createdAt: json['created_at'] == null
? null
: DateTime.parse(json['created_at'] as String),
updatedAt: json['updated_at'] == null
? null
: DateTime.parse(json['updated_at'] as String),
lastActive: json['last_active'] == null
? null
: DateTime.parse(json['last_active'] as String),
extraData: json['extra_data'] as Map<String, dynamic>? ?? {},
online: json['online'] as bool? ?? false,
banned: json['banned'] as bool? ?? false,
teams:
(json['teams'] as List<dynamic>?)?.map((e) => e as String).toList() ??
[],
language: json['language'] as String?,
);
}
User _$UserFromJson(Map<String, dynamic> json) => User(
id: json['id'] as String,
role: json['role'] as String?,
createdAt: json['created_at'] == null
? null
: DateTime.parse(json['created_at'] as String),
updatedAt: json['updated_at'] == null
? null
: DateTime.parse(json['updated_at'] as String),
lastActive: json['last_active'] == null
? null
: DateTime.parse(json['last_active'] as String),
extraData: json['extra_data'] as Map<String, dynamic>? ?? const {},
online: json['online'] as bool? ?? false,
banned: json['banned'] as bool? ?? false,
teams:
(json['teams'] as List<dynamic>?)?.map((e) => e as String).toList() ??
const [],
language: json['language'] as String?,
);
Map<String, dynamic> _$UserToJson(User instance) {
final val = <String, dynamic>{
+1 -1
View File
@@ -3,4 +3,4 @@ import 'package:stream_chat/src/client/client.dart';
/// Current package version
/// Used in [StreamChatClient] to build the `x-stream-client` header
// ignore: constant_identifier_names
const PACKAGE_VERSION = '3.0.0';
const PACKAGE_VERSION = '3.1.1';
+3 -5
View File
@@ -1,7 +1,7 @@
name: stream_chat
homepage: https://getstream.io/
description: The official Dart client for Stream Chat, a service for building chat applications.
version: 3.0.0
version: 3.1.1
repository: https://github.com/GetStream/stream-chat-flutter
issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues
@@ -29,8 +29,6 @@ dev_dependencies:
build_runner: ^2.0.1
dart_code_metrics: ^4.2.0-dev.5
freezed: ^0.14.1+3
json_serializable: ^4.1.0
json_serializable: ^5.0.2
mocktail: ^0.1.1
# Remove fixed version once the below issue is fixed
# https://github.com/flutter/flutter/issues/91059
test: 1.17.12
test: ^1.18.2
+12 -1
View File
@@ -1,14 +1,25 @@
## Upcoming
- Updated Dart SDK constraints to `>=2.14.0 <3.0.0`
## 3.1.1
- Updated `stream_chat_flutter_core` dependency to [`3.1.1`](https://pub.dev/packages/stream_chat_flutter_core/changelog).
- Updated `file_picker`, `image_gallery_saver`, and `video_thumbnail` to the latest versions.
🐞 Fixed
-[[#687]](https://github.com/GetStream/stream-chat-flutter/issues/687): Fix Users losing their place in the conversation after replying in threads.
- [[#687]](https://github.com/GetStream/stream-chat-flutter/issues/687): Fix Users losing their place in the conversation after replying in threads.
- Fixed floating date stream subscription causing "Bad state: stream has already been listened.” error.
- Fixed `String` capitalize extension not working on empty strings.
✅ Added
- Added `MessageInput.customOverlays` property to add custom overlays to the message input.
- Added `MessageInput.mentionAllAppUsers` property to mention all app users in the message input.
- The `MessageInput` now supports local search for channels with less than 100 members.
- Added `MessageListView.paginationLoadingIndicatorBuilder` to override the default loading indicator shown while paginating the message list.
- Added new `linkBackgroundColor` in `MessageTheme` for setting background colors of link attachments.
⚠️ Deprecated
@@ -34,7 +34,7 @@ Future<void> main() async {
await client.connectUser(
User(id: 'super-band-9'),
'''eyJ0eXAiO«iJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoic3VwZXItYmFuZC05In0.0L6lGoeLwkz0aZRUcpZKsvaXtNEDHBcezVTZ0oPq40A''',
'''eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoic3VwZXItYmFuZC05In0.0L6lGoeLwkz0aZRUcpZKsvaXtNEDHBcezVTZ0oPq40A''',
);
runApp(
@@ -10,6 +10,7 @@ class UrlAttachment extends StatelessWidget {
Key? key,
required this.urlAttachment,
required this.hostDisplayName,
required this.messageTheme,
this.textPadding = const EdgeInsets.symmetric(
horizontal: 16,
vertical: 8,
@@ -25,6 +26,9 @@ class UrlAttachment extends StatelessWidget {
/// Padding for text
final EdgeInsets textPadding;
/// [MessageThemeData] for showing image title
final MessageThemeData messageTheme;
@override
Widget build(BuildContext context) {
final chatThemeData = StreamChatTheme.of(context);
@@ -58,7 +62,7 @@ class UrlAttachment extends StatelessWidget {
borderRadius: const BorderRadius.only(
topRight: Radius.circular(16),
),
color: chatThemeData.colorTheme.linkBg,
color: messageTheme.linkBackgroundColor,
),
child: Padding(
padding: const EdgeInsets.only(
@@ -12,7 +12,7 @@ final _emojiChars = Emoji.chars();
extension StringExtension on String {
/// Returns the capitalized string
String capitalize() =>
'${this[0].toUpperCase()}${substring(1).toLowerCase()}';
isNotEmpty ? '${this[0].toUpperCase()}${substring(1).toLowerCase()}' : '';
/// Returns whether the string contains only emoji's or not.
///
@@ -386,6 +386,9 @@ class MessageInputState extends State<MessageInput> {
Timer? _slowModeTimer;
void _startSlowMode() {
if (!mounted) {
return;
}
final channel = StreamChannel.of(context).channel;
final cooldownStartedAt = channel.cooldownStartedAt;
if (cooldownStartedAt != null) {
@@ -170,6 +170,7 @@ class MessageListView extends StatefulWidget {
this.messageListController,
this.reverse = true,
this.paginationLimit = 20,
this.paginationLoadingIndicatorBuilder,
}) : super(key: key);
/// Function used to build a custom message widget
@@ -285,6 +286,9 @@ class MessageListView extends StatefulWidget {
/// Use [ChannelListController.paginateData] pagination.
final MessageListController? messageListController;
/// Builder used to build the loading indicator shown while paginating.
final WidgetBuilder? paginationLoadingIndicatorBuilder;
@override
_MessageListViewState createState() => _MessageListViewState();
}
@@ -294,7 +298,6 @@ class _MessageListViewState extends State<MessageListView> {
void Function(Message)? _onThreadTap;
bool _showScrollToBottom = false;
late final ItemPositionsListener _itemPositionListener;
late final Stream<Iterable<ItemPosition>> _itemPositionStream;
int? _messageListLength;
StreamChannelState? streamChannel;
late StreamChatThemeData _streamTheme;
@@ -576,17 +579,22 @@ class _MessageListViewState extends State<MessageListView> {
}
}
final indicatorBuilder =
widget.paginationLoadingIndicatorBuilder;
if (i == itemCount - 3) {
return _buildLoadingIndicator(
return _loadingIndicator(
streamChannel!,
QueryDirection.top,
indicatorBuilder: indicatorBuilder,
);
}
if (i == 1) {
return _buildLoadingIndicator(
return _loadingIndicator(
streamChannel!,
QueryDirection.bottom,
indicatorBuilder: indicatorBuilder,
);
}
@@ -668,7 +676,8 @@ class _MessageListViewState extends State<MessageListView> {
right: 0,
child: BetterStreamBuilder<Iterable<ItemPosition>>(
initialData: _itemPositionListener.itemPositions.value,
stream: _itemPositionStream,
stream: _valueListenableToStreamAdapter(
_itemPositionListener.itemPositions),
comparator: (a, b) {
if (a == null || b == null) {
return false;
@@ -819,15 +828,17 @@ class _MessageListViewState extends State<MessageListView> {
},
);
Widget _buildLoadingIndicator(
Widget _loadingIndicator(
StreamChannelState streamChannel,
QueryDirection direction,
) =>
QueryDirection direction, {
WidgetBuilder? indicatorBuilder,
}) =>
_LoadingIndicator(
direction: direction,
streamTheme: _streamTheme,
streamChannel: streamChannel,
isThreadConversation: _isThreadConversation,
indicatorBuilder: indicatorBuilder,
);
Widget _buildBottomMessage(
@@ -1197,8 +1208,6 @@ class _MessageListViewState extends State<MessageListView> {
_scrollController = widget.scrollController ?? ItemScrollController();
_itemPositionListener =
widget.itemPositionListener ?? ItemPositionsListener.create();
_itemPositionStream =
_valueListenableToStreamAdapter(_itemPositionListener.itemPositions);
_getOnThreadTap();
super.initState();
@@ -1297,12 +1306,14 @@ class _LoadingIndicator extends StatelessWidget {
required this.isThreadConversation,
required this.direction,
required this.streamChannel,
this.indicatorBuilder,
}) : super(key: key);
final StreamChatThemeData streamTheme;
final bool isThreadConversation;
final QueryDirection direction;
final StreamChannelState streamChannel;
final WidgetBuilder? indicatorBuilder;
@override
Widget build(BuildContext context) {
@@ -1321,12 +1332,13 @@ class _LoadingIndicator extends StatelessWidget {
),
builder: (context, data) {
if (!data) return const Offstage();
return const Center(
child: Padding(
padding: EdgeInsets.all(8),
child: CircularProgressIndicator(),
),
);
return indicatorBuilder?.call(context) ??
const Center(
child: Padding(
padding: EdgeInsets.all(8),
child: CircularProgressIndicator(),
),
);
},
);
}
@@ -7,6 +7,7 @@ import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';
import 'package:flutter_portal/flutter_portal.dart';
import 'package:jiffy/jiffy.dart';
import 'package:stream_chat_flutter/src/attachment/url_attachment.dart';
import 'package:stream_chat_flutter/src/extension.dart';
import 'package:stream_chat_flutter/src/image_group.dart';
import 'package:stream_chat_flutter/src/message_action.dart';
@@ -15,7 +16,6 @@ import 'package:stream_chat_flutter/src/message_reactions_modal.dart';
import 'package:stream_chat_flutter/src/quoted_message_widget.dart';
import 'package:stream_chat_flutter/src/reaction_bubble.dart';
import 'package:stream_chat_flutter/src/theme/themes.dart';
import 'package:stream_chat_flutter/src/url_attachment.dart';
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
/// Widget builder for building attachments
@@ -1010,6 +1010,7 @@ class _MessageWidgetState extends State<MessageWidget>
urlAttachment: urlAttachment,
hostDisplayName: hostDisplayName,
textPadding: widget.textPadding,
messageTheme: widget.messageTheme,
);
}
@@ -1348,7 +1349,7 @@ class _MessageWidgetState extends State<MessageWidget>
}
if (hasUrlAttachments) {
return _streamChatTheme.colorTheme.linkBg;
return widget.messageTheme.linkBackgroundColor;
}
if (isOnlyEmoji) {
@@ -285,7 +285,7 @@ class QuotedMessageWidget extends StatelessWidget {
Color? _getBackgroundColor(BuildContext context) {
if (_containsLinkAttachment) {
return StreamChatTheme.of(context).colorTheme.linkBg;
return messageTheme.linkBackgroundColor;
}
return messageTheme.messageBackgroundColor;
}
@@ -223,6 +223,7 @@ class StreamChatThemeData {
messageLinksStyle: TextStyle(
color: accentColor,
),
linkBackgroundColor: colorTheme.linkBg,
),
otherMessageTheme: MessageThemeData(
reactionsBackgroundColor: colorTheme.disabled,
@@ -246,6 +247,7 @@ class StreamChatThemeData {
width: 32,
),
),
linkBackgroundColor: colorTheme.linkBg,
),
messageInputTheme: MessageInputThemeData(
borderRadius: BorderRadius.circular(20),
@@ -18,6 +18,7 @@ class MessageThemeData with Diagnosticable {
this.reactionsMaskColor,
this.avatarTheme,
this.createdAtStyle,
this.linkBackgroundColor,
});
/// Text style for message text
@@ -53,6 +54,9 @@ class MessageThemeData with Diagnosticable {
/// Theme of the avatar
final AvatarThemeData? avatarTheme;
/// Background color for messages with url attachments.
final Color? linkBackgroundColor;
/// Copy with a theme
MessageThemeData copyWith({
TextStyle? messageTextStyle,
@@ -66,6 +70,7 @@ class MessageThemeData with Diagnosticable {
Color? reactionsBackgroundColor,
Color? reactionsBorderColor,
Color? reactionsMaskColor,
Color? linkBackgroundColor,
}) =>
MessageThemeData(
messageTextStyle: messageTextStyle ?? this.messageTextStyle,
@@ -81,6 +86,7 @@ class MessageThemeData with Diagnosticable {
reactionsBackgroundColor ?? this.reactionsBackgroundColor,
reactionsBorderColor: reactionsBorderColor ?? this.reactionsBorderColor,
reactionsMaskColor: reactionsMaskColor ?? this.reactionsMaskColor,
linkBackgroundColor: linkBackgroundColor ?? this.linkBackgroundColor,
);
/// Linearly interpolate from one [MessageThemeData] to another.
@@ -109,6 +115,8 @@ class MessageThemeData with Diagnosticable {
reactionsMaskColor:
Color.lerp(a.reactionsMaskColor, b.reactionsMaskColor, t),
repliesStyle: TextStyle.lerp(a.repliesStyle, b.repliesStyle, t),
linkBackgroundColor:
Color.lerp(a.linkBackgroundColor, b.linkBackgroundColor, t),
);
/// Merge with a theme
@@ -131,6 +139,7 @@ class MessageThemeData with Diagnosticable {
reactionsBackgroundColor: other.reactionsBackgroundColor,
reactionsBorderColor: other.reactionsBorderColor,
reactionsMaskColor: other.reactionsMaskColor,
linkBackgroundColor: other.linkBackgroundColor,
);
}
@@ -149,7 +158,8 @@ class MessageThemeData with Diagnosticable {
reactionsBackgroundColor == other.reactionsBackgroundColor &&
reactionsBorderColor == other.reactionsBorderColor &&
reactionsMaskColor == other.reactionsMaskColor &&
avatarTheme == other.avatarTheme;
avatarTheme == other.avatarTheme &&
linkBackgroundColor == other.linkBackgroundColor;
@override
int get hashCode =>
@@ -163,7 +173,8 @@ class MessageThemeData with Diagnosticable {
reactionsBackgroundColor.hashCode ^
reactionsBorderColor.hashCode ^
reactionsMaskColor.hashCode ^
avatarTheme.hashCode;
avatarTheme.hashCode ^
linkBackgroundColor.hashCode;
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
@@ -179,6 +190,7 @@ class MessageThemeData with Diagnosticable {
..add(DiagnosticsProperty('avatarTheme', avatarTheme))
..add(ColorProperty('reactionsBackgroundColor', reactionsBackgroundColor))
..add(ColorProperty('reactionsBorderColor', reactionsBorderColor))
..add(ColorProperty('reactionsMaskColor', reactionsMaskColor));
..add(ColorProperty('reactionsMaskColor', reactionsMaskColor))
..add(ColorProperty('linkBackgroundColor', linkBackgroundColor));
}
}
+7 -7
View File
@@ -1,12 +1,12 @@
name: stream_chat_flutter
homepage: https://github.com/GetStream/stream-chat-flutter
description: Stream Chat official Flutter SDK. Build your own chat experience using Dart and Flutter.
version: 3.0.0
version: 3.1.1
repository: https://github.com/GetStream/stream-chat-flutter
issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues
environment:
sdk: '>=2.12.0 <3.0.0'
sdk: '>=2.14.0 <3.0.0'
flutter: ">=1.17.0"
dependencies:
@@ -17,7 +17,7 @@ dependencies:
diacritic: ^0.1.3
dio: ^4.0.0
ezanimation: ^0.5.0
file_picker: ^3.0.1
file_picker: ^4.1.3
flutter:
sdk: flutter
flutter_markdown: ^0.6.1
@@ -25,7 +25,7 @@ dependencies:
flutter_slidable: ^0.6.0
flutter_svg: ^0.22.0
http_parser: ^4.0.0
image_gallery_saver: ^1.6.9
image_gallery_saver: ^1.7.0
image_picker: ^0.8.2
jiffy: ^4.1.0
lottie: ^1.0.1
@@ -37,13 +37,13 @@ dependencies:
scrollable_positioned_list: ^0.2.0-nullsafety.0
share_plus: ^2.0.3
shimmer: ^2.0.0
stream_chat_flutter_core: ^3.0.0
stream_chat_flutter_core: ^3.1.1
substring_highlight: ^1.0.26
synchronized: ^3.0.0
url_launcher: ^6.0.3
video_compress: ^3.0.0
video_player: ^2.1.0
video_thumbnail: ^0.3.3
video_thumbnail: ^0.4.3
visibility_detector: ^0.2.0
flutter:
@@ -58,6 +58,6 @@ dev_dependencies:
dart_code_metrics: ^4.2.0-dev.5
flutter_test:
sdk: flutter
golden_toolkit: ^0.9.0
golden_toolkit: ^0.10.0
mocktail: ^0.1.2
path: ^1.8.0
@@ -59,6 +59,7 @@ final _messageThemeControl = MessageThemeData(
messageLinksStyle: TextStyle(
color: ColorTheme.light().accentPrimary,
),
linkBackgroundColor: ColorTheme.light().linkBg,
);
final _messageThemeControlDark = MessageThemeData(
@@ -87,4 +88,5 @@ final _messageThemeControlDark = MessageThemeData(
messageLinksStyle: TextStyle(
color: ColorTheme.dark().accentPrimary,
),
linkBackgroundColor: ColorTheme.dark().linkBg,
);
@@ -1,3 +1,7 @@
## 3.1.1
- Updated `stream_chat` dependency to [`3.1.1`](https://pub.dev/packages/stream_chat/changelog).
## 3.0.0
- Updated `stream_chat` dependency to [`3.0.0`](https://pub.dev/packages/stream_chat/changelog).
@@ -1,7 +1,7 @@
name: stream_chat_flutter_core
homepage: https://github.com/GetStream/stream-chat-flutter
description: Stream Chat official Flutter SDK Core. Build your own chat experience using Dart and Flutter.
version: 3.0.0
version: 3.1.1
repository: https://github.com/GetStream/stream-chat-flutter
issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues
@@ -16,7 +16,7 @@ dependencies:
sdk: flutter
meta: ^1.3.0
rxdart: ^0.27.0
stream_chat: ^3.0.0
stream_chat: ^3.1.1
dev_dependencies:
dart_code_metrics: ^4.2.0-dev.5
@@ -558,7 +558,6 @@ void main() {
config: ChannelConfig(),
createdAt: DateTime.now(),
memberCount: 1,
cooldown: 0,
),
);