2

我有一个带有流构建器的活动页面,我需要暂时暂停流,然后重新激活它,它可以在颤动中完成吗?

StreamBuilder(
  stream: Firestore.instance
                .collection('groups')
                .where("participants", arrayContains: currentUserId)
                .where("lastUpdate", isGreaterThan: lastFetchTimestamp)
                .orderBy('lastUpdate', descending: true)
                .limit(30),
  builder: (BuildContext context, AsyncSnapshot<int> snapshot) { 
    if (snapshot.hasError)
      return Text('Error: ${snapshot.error}');
    else
      return Text('OK');
  }, 
)

当我更改页面时,我想暂停流

// PAUSE STREAM THEN

 Navigator.push(
                context,
                MaterialPageRoute(
                    builder: (context) => Chat())
);

谢谢。

4

0 回答 0