Firestore User with GetX | Todo App

  Рет қаралды 15,540

Tadas Petra

Tadas Petra

Күн бұрын

Пікірлер
@jakewoodruff13
@jakewoodruff13 3 жыл бұрын
Great tutorial for exactly what I was needing to know how to build thanks!
@LeagueRandomPlayer
@LeagueRandomPlayer 4 жыл бұрын
as always epic work! some of the method and classes here are deprecated but worry not if you use at least android studio it will let you know. i recomend following the docs in FlutterFire along this great video!
@tadaspetra
@tadaspetra 4 жыл бұрын
Yes they unfortunately changed a lot on me haha. But hopefully people still are able to upgrade with the quality docs
@TPITEOTG
@TPITEOTG 11 ай бұрын
Thank you for excellent "best practices" guidance! Question: do you use VSC extension to fill "User.fromDocumentSnapshot"? Which extensions do you recommend? Thanks
@TheCryptoFlowerman
@TheCryptoFlowerman 3 жыл бұрын
Love your videos!! Finally I am at a level to follow along(or maybe just not). Just one question.... when I try your example in flutter null safety I get an error (unexpected null value) and I can’t get me head around it....... instead of Getx in the rootScreen, I am using Obs... it works but for me the logic isn’t clear.... any suggestions? Keep on going with the videos, love them!
@singhaseyha4375
@singhaseyha4375 3 жыл бұрын
that is the great tutorial, but can you share us how to get pagination with getX by using bindstream to append the next list?? please... i'm stuck
@jrheisler
@jrheisler 4 жыл бұрын
Cool stuff!
@tadaspetra
@tadaspetra 4 жыл бұрын
Thank you! Appreciate it!
@ratrakone3761
@ratrakone3761 4 жыл бұрын
AuthResult is now UserCredential
@CmdrVimes177
@CmdrVimes177 3 жыл бұрын
Hey Tadas, great series of tutorials - keep up the good work. I managed to follow thorough the Firebase Auth video ok and was able to update it to take into account the Firebase breaking changes but I have a problem with this video and I cannot see how to solve it. I am getting a Exception caught by widgets library - 'Null check operator used on null value' error in the Root() component. I think its the line that checks the user.uid that is the problem but I cannot see how to solve it. Can you help? Ok, so a further check seems to suggest that it is the entire Root() widget not the user.uid check as I first thought. Still stuck :-(
@GabrielHahn
@GabrielHahn 3 жыл бұрын
Same problem with me! Did you manage to solve this error?
@ibrahimmugaibel5811
@ibrahimmugaibel5811 3 жыл бұрын
@@GabrielHahn in DataBase>getUser method add "?" to (String? uid) and in the sign in method add '?' to (_authResult.user?.uid)
@boonchaan
@boonchaan 3 жыл бұрын
Hi Todas I really enjoyed learning with you but I have a quick. maybe not that quici question. this is all very well for nativa apps in witch you log in and the app stays there. but for web the user can refresh. In my case im loosing the user at usercontroller. my idea is to create the database as Singleton passing the user uid to have it handy for saared data across users that is accessed by the user id at an array. but. the question is. can I somehow watch onAuthStatechange and set both the user at userController and the id at the singleton? maybe im a bit confusing. let me know if you have some time. cheers! and thanks for the amazing guidance
@crazymusicnetwork8844
@crazymusicnetwork8844 4 жыл бұрын
Great video how i can update UserController usercontroller = Get.put(UserController()); because i want reload new info of the user. Thanks
@tadaspetra
@tadaspetra 4 жыл бұрын
Create a function inside the UserController to update
@raymondmichael4987
@raymondmichael4987 4 жыл бұрын
I have been pulling my hair here for several minutes; Why I get squiggly line under AuthResult in the authController file; yelling "undefined class"; any thought btw, I tried to avoid "deprecated" errors, will that be the reason? :) That was the new thing I had to change too for comply with the new version of firebase; AuthResult => UserCredential case solved!!
@tadaspetra
@tadaspetra 4 жыл бұрын
Yea firebase and firestore changed a lot of things since this video came out unfortunately. but glad you figured it out!
@lamafattal3315
@lamafattal3315 2 жыл бұрын
Hello, whenever i hot restart the data is lost from the UI but its stored in firestore. How do i fix this problem?
@21izah
@21izah 2 жыл бұрын
By observable you mean notifying to changes right?
@elgusotube11
@elgusotube11 4 жыл бұрын
Cool Example. Do you make a example with GraphQL and GetX?. For example Hasura GraphQL works with suscriptions for real-time data changes, and having an example of these would be great. Thank you in advance for so many contributions.
@tadaspetra
@tadaspetra 4 жыл бұрын
Gustavo Delgado I've never used graphQL at all lol. I should check it out! Thanks!
@sakethparimi7664
@sakethparimi7664 3 жыл бұрын
i am getting The getter 'message' isn't defined for the type 'Object' in catch(e)
@syed.zain.gillani
@syed.zain.gillani 4 жыл бұрын
Hi, I am getting this error on this line email = doc['email']; [] isnt defined for the type DocumentSnapshot
@tadaspetra
@tadaspetra 4 жыл бұрын
Are you sure email field is defined for that document? In firestore
@ReelSkilla
@ReelSkilla 4 жыл бұрын
Calling [] directly is deprecated with the latest firestore
@agreensh
@agreensh 4 жыл бұрын
Thanks for this, very useful. One thing I'm not sure of - why have you added email to your UserModel (and FireStore)? It's already part of the AuthResult from create or login (with email and password) - authResult.user.email - so no need to store it. Maybe it should still be part of the UserModel for convenience, but no need to store it separately - just initialize it from the AuthResult (save on FireStore data, and read/write counts).
@tadaspetra
@tadaspetra 4 жыл бұрын
Andy Greenshaw you are right it is stored in the Auth, but for my UserModel I usually like to store all the user information into that. So then I can call it once from wherever I need it and have it ready. For example: let’s say you have a profile page, and want to display all the info. Here you just make one function call and you have everything
@agreensh
@agreensh 4 жыл бұрын
@@tadaspetra That's why I say it should still be in the UserModel for convenience - but if you add/fetch it to/from FireStore as well, you're increasing your Firebase cost (assuming you have lots of users!).
@tadaspetra
@tadaspetra 4 жыл бұрын
Andy Greenshaw how would you retrieve the email for someone else’s profile page?
@agreensh
@agreensh 4 жыл бұрын
@@tadaspetra I wouldn't expose the email (privacy issue), only their name (and identified by the userid). If you do need the email (eg so one user can email another, if you really need to), then do that on the backend (via a cloud function).
@tadaspetra
@tadaspetra 4 жыл бұрын
Andy Greenshaw yea you can do that. But personally I just like to store, I feel like it makes things a lot easier. And Firebase charges per document read. So it is still one document read with the email in there
@jaimepremy
@jaimepremy 4 жыл бұрын
Another excellent video on GetX, and now with Firebase it's really getting exciting. Looking forward to see some videos on working with Firestore streams in GetX. Often times we need to combine and manipulate data from 2 or more documents, before we send this off to the view. I've been doing this with BLOC and RxDart up to now, but I guess it will be much less of a pain with GetX. I did some experimenting like this: final videos = List().obs; VideoController() { _videoService = VideoService(); } @override void onReady() async { videos.bindStream(loadVideos()); super.onInit(); } Stream loadVideos() { return _videoService.getAll(); } The controller is Lazy initialized with binding. The view looks like this: body: GetX(builder: (_) { if (_.videos.length == 0) { return Center(child: Text('Nothing to show yet...')); } return ListView.separated( separatorBuilder: (context, index) => Divider( color: Colors.grey, ), itemCount: _.videos.length, itemBuilder: (context, index) { return VideoTile(_.videos.elementAt(index)); }); }), The data shows up fine but does not update in real time if I modify some field in the db. The only way I found to have it update real time is to initialize the Controller in main.dart, but this creates the stream even before I requested it, so it's not very efficient. Imagine an app with dozens of streams getting initialized at startup. So I definitely need to master GetX a bit more and my hope's are on you for now ;-)
@tadaspetra
@tadaspetra 4 жыл бұрын
Jaime Baum that's definitely an important use case. One note, you're binding the stream onReady, maybe try onInit. I don't know if that would change anything but it's weird that it doesn't get updated 😕
@jaimepremy
@jaimepremy 4 жыл бұрын
@@tadaspetra Thanks, will try.
@jaimepremy
@jaimepremy 4 жыл бұрын
onInit didn't do the trick either. I ended up with this: //VideoController final videos = List().obs; @override void onInit() async { _videoService.getVideos(); } //VideoService void getVideos() async { Firestore.instance .collection("videos") .snapshots() .listen(_setVideos, cancelOnError: true); } void _setVideos(QuerySnapshot qss) { RxList videos = Get.find().videos; videos.clear(); List vdoList = qss.documents.map((e) => Video.fromSnapshot(e)).toList(); vdoList.forEach((element) { videos.add(element); }); } And now it works. I'm sure there's are better ways of doing this, but this might already help others with a similar requirement.
@lbarria11
@lbarria11 3 жыл бұрын
Hi How are yo im getting this error in the root.dart in the uid is with a red mark builder: (_) { if (Get.find().user?.uid != null) { and give me this error The getter 'uid' isn't defined for the type 'String'. Try importing the library that defines 'uid', correcting the name to the name of an existing getter, or defining a getter or field named 'uid'.
@nikalags
@nikalags 3 жыл бұрын
same
@lbarria11
@lbarria11 3 жыл бұрын
what i do was delete the ?.uid!
@sakethparimi7664
@sakethparimi7664 3 жыл бұрын
In auth controller the user getter method returns a User not a String. and put _firebaseUser.value instead. Hope this helped!
@emreozbey9417
@emreozbey9417 3 жыл бұрын
@@sakethparimi7664 hey I fixed this error but now "Null check operator used on a null value" i am getting the error can you help me pls :)
@kribasrimal3778
@kribasrimal3778 3 жыл бұрын
Help! it says Null check operator used on a null value
@Krupupakku
@Krupupakku 3 жыл бұрын
same error here
@super10tamil93
@super10tamil93 3 жыл бұрын
String ? Name;
@TheCryptoFlowerman
@TheCryptoFlowerman 3 жыл бұрын
Same here!
@emreozbey9417
@emreozbey9417 3 жыл бұрын
same here
@novacoax
@novacoax Жыл бұрын
Same Here. 1 year after
@blacksandedm3894
@blacksandedm3894 4 жыл бұрын
hey i have following error: AuthController not found. You need call put(AuthController()) anyone know when / where to call auth controller? If i call it in the wrapper i get a uid even if no user has been created
@tadaspetra
@tadaspetra 4 жыл бұрын
In the previous video we set up the Auth controller in the initialBinding 😊
@silverCap00
@silverCap00 3 жыл бұрын
It seems mouse and USB-c hub amazon site url are same. Anyway, always thank you for the great lectures!
@tadaspetra
@tadaspetra 3 жыл бұрын
You are right about that lol. Thank you for catching that and pointing it out
@alvincastillo3931
@alvincastillo3931 4 жыл бұрын
Tadas impressive about getx but what about a splashscreen do you have to initialize the usercontroller at the same time that the authcontroller? or u will binding with the page ?
@tadaspetra
@tadaspetra 4 жыл бұрын
Alvin Castillo there's multiple ways to add a splash screen. I think either of your options would work. I'm not sure which way i prefer yet 😅
@victorlongoro4574
@victorlongoro4574 3 жыл бұрын
hi tadas, first thanks for the great tutorial it was awesome, simple to understand and it help me allots but the question here comes. am handling roles in my firebase i.e. admin and customer, am trying to manipulate the root so it provide the routes accordingly but it throw an error for me, try implemented this in provider and it works fine but in getx it really confusing, help me out
@kanegomolema7357
@kanegomolema7357 4 жыл бұрын
can you please do firebase storage tutorial
@tadaspetra
@tadaspetra 4 жыл бұрын
kanego molema already have one 😊 kzbin.info/www/bejne/rpukXqyFg72JsNU
@user-rc2nt1tb2u
@user-rc2nt1tb2u 3 жыл бұрын
When I write this one👇🏻I get an error, any one can help me please? UserModel.fromDocumentSnapshot(DocumentSnapshot doc) { }
@LtWittmann
@LtWittmann 4 жыл бұрын
I don't mean anything, but most of your tutorial is deprecated :( Could you update them? I may wrong tho, so sorry if I am
@tadaspetra
@tadaspetra 4 жыл бұрын
No you are right, it’s because Firebase updated all the setup required. They have a guide for how to update. The overall concept of the video still works, just need to update the initialization
@humansmachines2732
@humansmachines2732 4 жыл бұрын
hey thanks for the great video but one question after closing the app and reopening it the user from the usercontroller is always null do i need to do some bindings or what else should I do ?
@tadaspetra
@tadaspetra 4 жыл бұрын
The user is stored on Firestore, so you could probably need to retrieve the information again, when you open it. I would do that in a binding, since it first checks auth and then leads you to another screen
@nikalags
@nikalags 3 жыл бұрын
In user.dart i can't use the variable id = doc.documentID; And in database.dart there is "Undefined class 'Firestore'." Help
@kishon2810
@kishon2810 3 жыл бұрын
id = doc.id
@Petter092
@Petter092 3 жыл бұрын
in database.dart replace Firestore for FirebaseFirestore
@rrbb
@rrbb 4 жыл бұрын
Hi , when i restart app, uid is stay but user.name is not load. i mean , when restarting app, root say, i have uid, go home, but home app bar have infinity loading, not name thanks for tutorial.
@lamafattal3315
@lamafattal3315 2 жыл бұрын
Hello, did u solve the problem?? Whenever i hot restart data is lost form the UI.
@mightycat2219
@mightycat2219 4 жыл бұрын
With respect, This channel is great but it really hard to learn from you. I would assume this is not a beginner lessons because you change the code between the video without explanation. I would suggest beginners to learn from Codex channel instead.
@tadaspetra
@tadaspetra 4 жыл бұрын
I appreciate the feedback. I try to cover the most important parts so that the videos don’t end up being too long. But I will take this into consideration
Firestore Stream with GetX | Todo App
13:24
Tadas Petra
Рет қаралды 18 М.
Firebase Auth with GetX | Todo App
14:05
Tadas Petra
Рет қаралды 33 М.
Правильный подход к детям
00:18
Beatrise
Рет қаралды 11 МЛН
REST API with GetX | Flutter tutorial | Shopping app
26:43
Understanding MVVM Docs by Building a Firebase Counter App
1:26:25
Tadas Petra
Рет қаралды 1,1 М.
Get CLI: A GetX Tool
10:44
Tadas Petra
Рет қаралды 18 М.
Effective debugging with dart devtools
1:17:24
FlutterBytes Community
Рет қаралды 409
I quit my job to work on Hungrimind
8:54
Tadas Petra
Рет қаралды 1,1 М.
My Ultimate VSCode Setup with Vim Keybindings
27:31
JavaScript Talks
Рет қаралды 131
Complete GetX State Management | Flutter
18:16
Tadas Petra
Рет қаралды 70 М.
Flutter Shopping Cart with Getx, Firebase & Stripe (Part 1)
16:48
Santos Enoque
Рет қаралды 64 М.