fix lint
This commit is contained in:
@@ -321,15 +321,6 @@ class Channel {
|
|||||||
).toList(),
|
).toList(),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (message.parentId != null && message.id == null) {
|
|
||||||
final parentMessage =
|
|
||||||
state!.messages!.firstWhere((m) => m.id == message.parentId);
|
|
||||||
|
|
||||||
state?.addMessage(parentMessage.copyWith(
|
|
||||||
replyCount: parentMessage.replyCount! + 1,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
state?.addMessage(message);
|
state?.addMessage(message);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -348,7 +339,7 @@ class Channel {
|
|||||||
message = await attachmentsUploadCompleter.future;
|
message = await attachmentsUploadCompleter.future;
|
||||||
}
|
}
|
||||||
|
|
||||||
final response = await (_client.sendMessage(message, id, type));
|
final response = await _client.sendMessage(message, id, type);
|
||||||
state?.addMessage(response!.message!);
|
state?.addMessage(response!.message!);
|
||||||
return response;
|
return response;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -466,8 +457,7 @@ class Channel {
|
|||||||
) {
|
) {
|
||||||
assert(() {
|
assert(() {
|
||||||
if (timeoutOrExpirationDate is! DateTime &&
|
if (timeoutOrExpirationDate is! DateTime &&
|
||||||
timeoutOrExpirationDate is! num &&
|
timeoutOrExpirationDate is! num) {
|
||||||
timeoutOrExpirationDate != null) {
|
|
||||||
throw ArgumentError('Invalid timeout or Expiration date');
|
throw ArgumentError('Invalid timeout or Expiration date');
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -997,7 +987,7 @@ class Channel {
|
|||||||
cid,
|
cid,
|
||||||
messagePagination: messagesPagination,
|
messagePagination: messagesPagination,
|
||||||
))!;
|
))!;
|
||||||
if (updatedState != null && updatedState.messages!.isNotEmpty) {
|
if (updatedState.messages!.isNotEmpty) {
|
||||||
if (state == null) {
|
if (state == null) {
|
||||||
_initState(updatedState);
|
_initState(updatedState);
|
||||||
} else {
|
} else {
|
||||||
@@ -1382,7 +1372,6 @@ class ChannelClientState {
|
|||||||
<Message>[...messages!, ...threads!.values.expand((v) => v)]
|
<Message>[...messages!, ...threads!.values.expand((v) => v)]
|
||||||
.where(
|
.where(
|
||||||
(message) =>
|
(message) =>
|
||||||
message.status != null &&
|
|
||||||
message.status != MessageSendingStatus.sent &&
|
message.status != MessageSendingStatus.sent &&
|
||||||
message.createdAt!.isBefore(
|
message.createdAt!.isBefore(
|
||||||
DateTime.now().subtract(
|
DateTime.now().subtract(
|
||||||
|
|||||||
@@ -723,9 +723,7 @@ class StreamChatClient {
|
|||||||
payload.addAll(options);
|
payload.addAll(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (paginationParams != null) {
|
|
||||||
payload.addAll(paginationParams.toJson());
|
payload.addAll(paginationParams.toJson());
|
||||||
}
|
|
||||||
|
|
||||||
final response = await get(
|
final response = await get(
|
||||||
'/channels',
|
'/channels',
|
||||||
@@ -765,8 +763,7 @@ class StreamChatClient {
|
|||||||
await _chatPersistenceClient?.updateChannelQueries(
|
await _chatPersistenceClient?.updateChannelQueries(
|
||||||
filter,
|
filter,
|
||||||
channels.map((c) => c.channel!.cid).toList(),
|
channels.map((c) => c.channel!.cid).toList(),
|
||||||
clearQueryCache:
|
clearQueryCache: paginationParams.offset == 0,
|
||||||
paginationParams.offset == null || paginationParams.offset == 0,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
state!.channels = updateData.key;
|
state!.channels = updateData.key;
|
||||||
@@ -794,7 +791,6 @@ class StreamChatClient {
|
|||||||
) {
|
) {
|
||||||
final channels = {...state!.channels ?? {}};
|
final channels = {...state!.channels ?? {}};
|
||||||
final newChannels = <Channel>[];
|
final newChannels = <Channel>[];
|
||||||
if (channelStates != null) {
|
|
||||||
for (final channelState in channelStates) {
|
for (final channelState in channelStates) {
|
||||||
final channel = channels[channelState.channel!.cid];
|
final channel = channels[channelState.channel!.cid];
|
||||||
if (channel != null) {
|
if (channel != null) {
|
||||||
@@ -806,7 +802,6 @@ class StreamChatClient {
|
|||||||
newChannels.add(newChannel);
|
newChannels.add(newChannel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return MapEntry(channels, newChannels);
|
return MapEntry(channels, newChannels);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1071,7 +1066,7 @@ class StreamChatClient {
|
|||||||
Map<String, dynamic>? messageFilters,
|
Map<String, dynamic>? messageFilters,
|
||||||
}) async {
|
}) async {
|
||||||
assert(() {
|
assert(() {
|
||||||
if (filters == null || filters.isEmpty) {
|
if (filters.isEmpty) {
|
||||||
throw ArgumentError('`filters` cannot be set as null or empty');
|
throw ArgumentError('`filters` cannot be set as null or empty');
|
||||||
}
|
}
|
||||||
if (query == null && messageFilters == null) {
|
if (query == null && messageFilters == null) {
|
||||||
@@ -1199,9 +1194,7 @@ class StreamChatClient {
|
|||||||
String? id,
|
String? id,
|
||||||
Map<String, dynamic>? extraData,
|
Map<String, dynamic>? extraData,
|
||||||
}) {
|
}) {
|
||||||
if (type != null &&
|
if (id != null && state!.channels?.containsKey('$type:$id') == true) {
|
||||||
id != null &&
|
|
||||||
state!.channels?.containsKey('$type:$id') == true) {
|
|
||||||
if (state!.channels!['$type:$id'] != null) {
|
if (state!.channels!['$type:$id'] != null) {
|
||||||
return state!.channels!['$type:$id'] as Channel;
|
return state!.channels!['$type:$id'] as Channel;
|
||||||
}
|
}
|
||||||
@@ -1369,8 +1362,7 @@ class StreamChatClient {
|
|||||||
) {
|
) {
|
||||||
assert(() {
|
assert(() {
|
||||||
if (timeoutOrExpirationDate is! DateTime &&
|
if (timeoutOrExpirationDate is! DateTime &&
|
||||||
timeoutOrExpirationDate is! num &&
|
timeoutOrExpirationDate is! num) {
|
||||||
timeoutOrExpirationDate != null) {
|
|
||||||
throw ArgumentError('Invalid timeout or Expiration date');
|
throw ArgumentError('Invalid timeout or Expiration date');
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/// Useful extension functions for [Map]
|
/// Useful extension functions for [Map]
|
||||||
extension MapX on Map {
|
extension MapX on Map {
|
||||||
/// Returns a new map with null keys or values removed
|
/// Returns a new map with null keys or values removed
|
||||||
Map<String, dynamic> get nullProtected => {...this as Map<String, dynamic>}
|
Map<String?, dynamic> get nullProtected => {...this as Map<String?, dynamic>}
|
||||||
..removeWhere((key, value) => key == null || value == null);
|
..removeWhere((key, value) => key == null || value == null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -314,9 +314,7 @@ class Message extends Equatable {
|
|||||||
|
|
||||||
/// Returns a new [Message] that is a combination of this message and the
|
/// Returns a new [Message] that is a combination of this message and the
|
||||||
/// given [other] message.
|
/// given [other] message.
|
||||||
Message merge(Message other) {
|
Message merge(Message other) => copyWith(
|
||||||
if (other == null) return this;
|
|
||||||
return copyWith(
|
|
||||||
id: other.id,
|
id: other.id,
|
||||||
text: other.text,
|
text: other.text,
|
||||||
type: other.type,
|
type: other.type,
|
||||||
@@ -346,7 +344,6 @@ class Message extends Equatable {
|
|||||||
pinExpires: other.pinExpires,
|
pinExpires: other.pinExpires,
|
||||||
pinnedBy: other.pinnedBy,
|
pinnedBy: other.pinnedBy,
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<Object?> get props => [
|
List<Object?> get props => [
|
||||||
|
|||||||
@@ -83,9 +83,7 @@ class Reaction {
|
|||||||
|
|
||||||
/// Returns a new [Reaction] that is a combination of this reaction and the
|
/// Returns a new [Reaction] that is a combination of this reaction and the
|
||||||
/// given [other] reaction.
|
/// given [other] reaction.
|
||||||
Reaction merge(Reaction other) {
|
Reaction merge(Reaction other) => copyWith(
|
||||||
if (other == null) return this;
|
|
||||||
return copyWith(
|
|
||||||
messageId: other.messageId,
|
messageId: other.messageId,
|
||||||
createdAt: other.createdAt,
|
createdAt: other.createdAt,
|
||||||
type: other.type,
|
type: other.type,
|
||||||
@@ -94,5 +92,4 @@ class Reaction {
|
|||||||
score: other.score,
|
score: other.score,
|
||||||
extraData: other.extraData,
|
extraData: other.extraData,
|
||||||
);
|
);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user