streamData2 method
Widget
streamData2({
- required dynamic snapshot,
- required Widget consumerFunc(),
- Map<
String, dynamic> ? where, - bool hasPage = false,
override
Implementation
@override
Widget streamData2({
required dynamic snapshot,
required Widget Function(List<Map<String, dynamic>> resultList) consumerFunc,
Map<String, dynamic>? where,
bool hasPage = false,
}) {
return StreamBuilder<List<Map<String, dynamic>>>(
stream: snapshot,
builder: (context, snapshot) {
if (snapshot.hasError) {
return Text('Error: ${snapshot.error}');
}
switch (snapshot.connectionState) {
case ConnectionState.waiting:
return const Text('Loading...');
default:
//print('streamData : ${snapshot.data!.length} data founded');
// 마지막 문서 업데이트 (페이징을 위해)
// if (hasPage) {
// startAfter = snapshot.data!.isNotEmpty ? snapshot.data!.last : null;
// }
return consumerFunc(filterSnapshotData(snapshot.data!, where));
}
},
);
}