watchWidgets method
Stream of widget entries from Firestore, sorted by priority.
Implementation
Stream<List<WidgetEntry>> watchWidgets() {
return _firestore
.collection('widgets')
.orderBy('priority', descending: true)
.snapshots()
.map((snapshot) {
return snapshot.docs.map((doc) {
final data = doc.data();
data['id'] = doc.id;
return WidgetEntry(
id: doc.id,
type: data['type'] as String? ?? '',
params: data['params'] as Map<String, dynamic>? ?? {},
common: data['common'] != null
? CommonParams.fromJson(data['common'] as Map<String, dynamic>)
: const CommonParams(),
);
}).toList();
});
}