Initial implementation

Signed-off-by: Sahil Kumar <[email protected]>
This commit is contained in:
Sahil Kumar
2020-12-22 21:45:14 +05:30
parent aa5433a881
commit 209c5a3c24
10 changed files with 359 additions and 313 deletions
+13
View File
@@ -267,6 +267,19 @@ class StreamChannelState extends State<StreamChannel> {
return state;
}
///
Future<Message> getMessage(String messageId) async {
var message = channel.state.messages.firstWhere(
(it) => it.id == messageId,
orElse: () => null,
);
if (message == null) {
final response = await channel.getMessagesById([messageId]);
message = response.messages.first;
}
return message;
}
/// Reloads the channel with latest message
Future<void> reloadChannel() => queryAtMessage(before: 30);