我正在Flutter中创建一个chat app
。我想在从ProgressBar
加载聊天消息时添加一个Firebase
。为此,我需要检查DataSnapshot
是否为空。如何检查?
我当前的代码:
child: new FirebaseAnimatedList(
query: reference,
padding: const EdgeInsets.all(8.0),
reverse: true,
sort: (a, b) => b.key.compareTo(a.key),
//comparing timestamp of messages to check which one would appear first
itemBuilder: (_, DataSnapshot messageSnapshot,
Animation<double> animation, int index) {
return new ChatMessageListItem(
messageSnapshot: messageSnapshot,
animation: animation,
);
},
),
),