dart_meteor
dart_meteor copied to clipboard
meteor.collection.listen it return wrong result
hi @tanutapi , i just test meteor.collection.listen it return wrong result after i change value args on meteor.subscribe it doesn't filter by new value of args, any idea ?
here what i did
late SubscriptionHandler? _subDepartmentHandler;
SubscriptionHandler? get subDepartmentHandler => _subDepartmentHandler;
// change branch method
void setBranch({required BranchModel branch}) {
_subDepartmentHandler!.stop();
startSubscribeDepartment(branchId: branch.id);
notifyListeners();
}
void startSubscribeDepartment({required String branchId}) {
Map<String, dynamic> selector = {};
selector['branchId'] = branchId;
// subscribe department
_subDepartmentHandler =
meteor.subscribe('rest.department', args: [selector], onReady: () {
meteor.collection('rest_departments').listen((result) {
print(result.values.toList()) <------ wrong result it get all records form collection without filter by args on meteor.subscribe
});
});
}