getDataRealTime static method
Implementation
static Future<StreamSubscription<DatabaseEvent>> getDataRealTime(
{required String path,
required Function(Object? value) listen,
Map<String, Object>? filter}) async {
DatabaseReference query = _db.child(path);
if (filter != null && filter.isNotEmpty) {
filter.forEach((key, value) {
query.orderByChild(key).equalTo(value);
});
}
var dataEvent = query.onValue.listen((event) {
listen(event.snapshot.value);
});
return dataEvent;
}