wip stream_chat.dart

This commit is contained in:
Neevash Ramdial
2021-04-20 10:35:40 +02:00
committed by Salvatore Giordano
parent 8f7471fec2
commit 34f2539595
@@ -1,6 +1,5 @@
import 'dart:async'; import 'dart:async';
import 'package:collection/collection.dart' show IterableExtension;
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:rxdart/rxdart.dart'; import 'package:rxdart/rxdart.dart';
@@ -27,9 +26,7 @@ class StreamChannel extends StatefulWidget {
required this.channel, required this.channel,
this.showLoading = true, this.showLoading = true,
this.initialMessageId, this.initialMessageId,
}) : assert(child != null, 'Child should not be null'), }) : super(key: key);
assert(channel != null, 'Channel should not be null'),
super(key: key);
// ignore: public_member_api_docs // ignore: public_member_api_docs
final Widget child; final Widget child;
@@ -189,16 +186,21 @@ class StreamChannelState extends State<StreamChannel> {
/// Query the channel members and watchers /// Query the channel members and watchers
Future<void> queryMembersAndWatchers() async { Future<void> queryMembersAndWatchers() async {
await widget.channel.query( final _members = channel.state?.members;
membersPagination: PaginationParams( if (_members != null) {
offset: channel.state.members?.length, await widget.channel.query(
limit: 100, membersPagination: PaginationParams(
), offset: _members.length,
watchersPagination: PaginationParams( limit: 100,
offset: channel.state.watchers?.length, ),
limit: 100, watchersPagination: PaginationParams(
), offset: _members.length,
); limit: 100,
),
);
} else {
return;
}
} }
/// Loads channel at specific message /// Loads channel at specific message