'getDocuments' is deprecated and shouldn't be used - firebase

VScode shows warning using getdocument and other functions from the firebase and Firestore. Can anyone please explain why it is showing.enter image description here

Don't worry , just use the function get() instead of getDocuments(). It basically means that the keyword get() is now preferred and supported over the getDocuments()keyword. Just use get() and it will work without any problem.

Related

Cannot change region of functions on flutter

Ive switched my functions regions from the US default and I cannot find a way to call them in flutter?
Is there a method of setting the region on the CloudFunctions instance or when you make the function calls
Thanks for the help.
I have managed to get this to work
CloudFunctions(app: FirebaseApp.instance, region: "europe-west2").getHttpsCallable(functionName: functionName);
But I am no longer using the singleton.
Is this a bad solution?
I don't see what's bad about it. You're doing exactly what you have to do. Just retain the result of CloudFunctions(app: FirebaseApp.instance, region: "europe-west2") in your own singleton if you want to reuse it.
I think the official solution is to use instanceFor:
final result =
await FirebaseFunctions.instanceFor(region: 'europe-west1').httpsCallable('addRental').call(jsonEncode(data));
worked for me, instead of
final result =
await FirebaseFunctions.instance.httpsCallable('addRental').call(jsonEncode(data));

Problem when retrieving uploaded file with Firebase Storage using Redux Saga

I'm using redux saga with firebase in an app. When I need to use the firebase storage and I need to get the download URL of a file I just upload:
this doesn't work
yield call (uploadTask.snapshot.ref.getDownloadURL);
but this work
yield call (() => uploadTask.snapshot.ref.getDownloadURL());
can anyone help me understand why the first option isn't working? I didn't understand the difference between these approaches :)
The difference between those is what value this has once getDownloadURL is running. The first version will have this equal to the window object (in non-strict mode) or undefined (in strict mode), while the latter will have this equal to uploadTask.snapshot.ref.
The call effect does have a couple of overloads which let you specify this. You can see them listed here, but one example is to pass in an array as the first argument, as in:
yield call([uploadTask.snapshot.ref, uploadTask.snapshot.ref.getDownloadURL])

Meteor.autorun vs Tracker.autorun?

What is the difference between Meteor.autorun and Tracker.autorun?
are they just aliases?
is one deprecated?
is there any instance where one is preferable to the other?
I'm well aware of the difference in using this.autorun in template lifecycle callbacks, but have seen these two used interchangeably and just want to be sure I haven't missed a trick.
Well, it can easily be found out with the identity operator.
This will be false because it is not the same function:
(function() {} === function() {})
Let's try with the two autorun :
(Meteor.autorun === Tracker.autorun)
This returns true. So yes it's only a pure alias.
However, only Tracker.autorun is documented. I suspect some kind of old API left for compatibility...
Let's check some Meteor code on GitHub!
File : deprecated.js
Meteor.autorun = Tracker.autorun;
This is in deprecated.js, it says some things about //Deprecated functions and some backward compatibility with Meteor 0.5.4. It seems pretty clear which one you should use.
You can find some other old timers in there, such as Deps...
Try to run Meteor.autorun(); in the console, it throws the following error Uncaught Error: Tracker.autorun requires a function argument like you were trying to run Tracker.autorun();

firebase ios gooffline remove observers

Simple question:
Will all obersvers automatically removed when I use goOffline (disconnect to firebase) ?
If not, is there another way to do it, because removeAllOberserves doesn't seem to work or must I keep an array of single handles?
UPDATE
I answer myself.
removeAllOberserves works well, if you call it with the reference you used to set the observer!
Example:
Firebase *userThreadRef;
userThreadRef = [userRef appendPathComponent: ThreadsPath];
[userThreadRef observeEventType: FEventTypeChildAdded withBlock: ^(FDataSnapshot *snapshot) {
...
}];
....
[userThreadRef removeAllObservers];
Do not use a new reference like this:
Firebase *newUserThreadRef = [userRef appendPathComponent: ThreadsPath];
[newUserThreadRef removeAllObservers];
Will all observers automatically removed when I use goOffline (disconnect to firebase) ?
No. Calling goOffline() will not automatically remove observers/listeners.
is there another way to do it, because removeAllOberserves doesn't seem to work or must I keep an array of single handles?
It's hard to say without seeing your code, but likely your expectations are just wrong.
You'll need to call removeAllObservers() on each reference. The All in the method name is for the fact that it removes the observers for all event types, not for all references.

Backbone.js binding (BackFire) model destroy function not working

I get the following error when i try to call destroy function to my Backbone Model:
Uncaught TypeError: Cannot call method 'apply' of undefined backbone-firebase.js:126
Backbone.Firebase.sync backbone-firebase.js:126
Backbone.sync backbone-firebase.js:154
h.extend.sync backbone-min.js:1
h.extend.destroy backbone-min.js:1
Backbone.View.extend.remove sample.html:79
p.event.dispatch jquery.min.js:2
g.handle.h
Code: http://dl.dropboxusercontent.com/u/14749491/sample.html
Since you're using the "implicit" sync method, don't use destroy to remove the model, use the remove method on the collection instead.
If you'd like to use destroy, I recommend using the "explicit" sync method,,using Backbone.Collection.extend with a firebase property. More information on these two methods here: https://github.com/firebase/backfire
I don't know anything about BackFire. But it appears to be a conflict between FireBase and BackBone-FireBase. Since the code you are loading from the FireBase cdn is minified method names (like delete in this case) have been changed. Try using the unminified version of FireBase and see if it works correctly.

Resources