Closed YouSour closed 3 years ago
With the version 1.x.x, you have to call meteor.prepareCollection('test') before you can access it. Make sure that your serverside code publish a test
collection.
here, i did @tanutapi but it still not work
on Server Side
import { Meteor } from 'meteor/meteor'
// Collection
import { MobileNotification } from '../../../common/collections/mobile-notification'
Meteor.publish('microfis_mobileNotification', function() {
if (this.userId) {
let data = MobileNotification.find();
return data;
}
return this.ready();
});
on Flutter
@override
void initState() {
super.initState();
meteor.prepareCollection('microfis_mobileNotification');
meteor.collections['microfis_mobileNotification'].listen((event) {
print('im listening ::::>>>>> $event');
});
}
On the Flutter side, make sure that you have subscribed to your publication.
...
class _YourWidgetState extends State<YourWidget> {
SubscriptionHandler _subscriptionHandler;
@override
void initState() {
super.initState();
meteor.prepareCollection('test');
_subscriptionHandler = meteor.subscribe('microfis_mobileNotification', []);
}
@override
void dispose() {
super.dispose();
_subscriptionHandler.stop();
}
}
...
thank you so much, it works @tanutapi 😄
hi , bro @tanutapi , is it possible to listen meteor.collections['test'] ? thank in advance :)