Firestore CRUD in Flutter - A complete guide

preview_player
Показать описание

---

This video cover the Create, read, update and delete functionalities using Firestore in Flutter.

Рекомендации по теме
Комментарии
Автор

I've been struggling for a long time to find an architecture style that I liked. When I found your videos, I felt complete lol. This is exactly the kind of architecture I've been looking for for so long! Thank you a lot man, I have a startup here in Brazil and this will help us so much! I even think my coding skills improved by a thousandfold after doing your tutorials. They are so straightforward and lean.


And I hope you keep posting more and more content each time! Cheers from Brazil!

kaiofelipereis
Автор

Dude your page is awesome, very understandable, and always thinking about others. You're helping make Flutter seem super easy now. I watch your page in between dev sessions to gain comfort with Flutter

pathoslp
Автор

nice. I am almost done with my app using your architecture but for sure I will refactor it once your tutorial is done. :)

ReelSkilla
Автор

Thanks for making this video! I've been looking for CRUD videos over the last few weeks and this one was by far the best!

nickbrodd
Автор

This tutorial is superb! Congratz! Very nice to see that you tackle the future approach as well as the realtime streams method.

henk
Автор

Hi Dane, great video, AGAIN! Thank you. I have three questions if you don't mind :)

1- 15:00 what's the benefit of creating a new StreamController and calling snapshots().listen() to populate the controller, instead of mapping whatever comes from the Firestore stream and map it to Posts, which would in turn be a Stream<List<Post>>. Basically =>
2- I'm curious how you organize your firestore_service.dart if you have a lot of entities, so you could have addPost, deletePost, updatePost, getPost, addComment, deleteComment, addReview, deleteReview, etc... the firestore_service could get too large, so basically it would be great to know how to organize a larger app.
3- Building on #2, how would you then handle queries, filters, etc, when working with firestore while still keeping things flexible regardless of which database is being used.

Again, thank you so much! Really appreciated all you do and share!

dc
Автор

Great video as usual! Just one note for beginners. Using streams is handy in dart, but you need to be careful and always dispose/close after the widget is removed from the screen. This with and also a good architecture in the database structure/modeling, can save you a lot on firebase billings as your app grows with more users.

storylineteam
Автор

Loved it, a nice clean way of doing things.
I was trying to understand the need for ViewModelProvider so I rebuilt last weeks code with ChangeNotifierProvider and Consumer. After doing that, and looking at your article on calling functions on start in Stateless Widgets, everything clicked into place and I definitely see the utility of ViewModelProvider, so great job there as well and thank you for sharing!

rod
Автор

Nice! Great! Almost all the elements I needed I could use. Unfortunately ONLY these elements alone. Only until now, I never knew how to put it all together Thanks to you everything is really easy now! Thanks for that.

kai-tobiaswillam
Автор

saved the day <3 I was going to request you for this to release it soon but you did it already. Thanks man appreciate the great efforts you are doing to educate others.

yashinherenttech
Автор

I have a problem, "Undefined class 'User'" in base_model.dart. When I run it (at 5:00) it will not compile. I have been through the coding changes four times but I am unable to find what I have missed. At 3:36 There is an orange squiggle underneath User. It is created in the authentication_service.dart which is imported into the base_model.dart Please help me.

johnjamesflashman
Автор

Awesome work man!

Please keep on going with your tutorials!

I’m really thankful!

Love the mvvp architecture too 😃

Cheers

alexzehet
Автор

These tutorials are great! Thank you!!

mcuddy
Автор

You are good, very good. Once again thank you.

johnjamesflashman
Автор

Hi FilledStacks, that is great video.


I have got the code of Compound from your github repo (040-firestore-crud)/final.
I set the flutter and firebase environment and it worked well.


Then, I added GlobalKey<ScaffoldState> for both login view, and home view, repectively, in order to somehow for showing snackbar when tap on the Compund Title in these two views.


static GlobalKey<ScaffoldState> globalKeyHome = 'home');
static GlobalKey<ScaffoldState> globalKeyLogin = 'login');


Globalkeys are static in order to reach the scaffold context via / globalKeyHome.currentState.showSnackBar, respectively.
All they worked. Snackbars were shown in both views.


Then I decided to implement LogOut process. I added an icon to Home View, then implemented the logout in HomeViewModel via AuthonticationService. It worked for the logout but navigation. When I tried to navigate to Login View, got the same error.


Future logOut() async {
await
await
}


I did not any change other than I mentioned above.


The program thrown an exception saying:
"Multiple widgets used the same GlobalKey.
The relevant error-causing widget was


In detail, it says:


"The following GlobalKey was specified multiple times in the widget tree.
This will lead to parts of the widget tree being truncated unexpectedly, because the second time a key is seen, the previous instance is moved to the new location. The key was:


- home]


This was determined by noticing that after the widget with the above global key was moved out of its previous parent, that previous parent never updated during this frame, meaning that it either did not update at all or updated before the widget was moved, in either case implying that it still thinks that it should have a child with that global key.


The specific parent that did not update after having one or more children forcibly removed due to GlobalKey reparenting is:


- [_LocalizationsScope-[GlobalKey#dad4d], _InheritedTheme,


A GlobalKey can only be specified on one widget at a time in the widget tree.
When the exception was thrown, this was the stack
."


I couldn't find a solution, I suspect this happened due to consumer and provided_architecture in deep, I don't know.


Can you check it. I will appreciate to you if you dedicate your some time for this issue.
Many thanks.

talatkuyuk
Автор

i've seen almost all of your videos and will prolly continue to watch all of them since you're a gem but the thing that attracted me the most is that you answer everyone in the comments ! basic ethics go a long way ! thanks man ! also i have a question is there a reason why you don't use the bloc architecture?

abdula
Автор

Great as always, I see your using BaseModeel for all the viewModels, , how does that fit now in the BaseViewModel in the stacked library

lnboa
Автор

One thing, the Dialogue Service throws an error if description isn't included (and it isn't mandatory).

rod
Автор

Thanks for the good videos you create. Really helpful and loaded with details.
Do you have a tutorial similar to this that uses GetX instead of Provider?

codewithsylvester
Автор

Hi Dane, I have a question about the ViewModelProvider architecture. Suppose in my HomeView (which is created using VMP<HomeViewModel>), I have a complex widget, like a drawer. When I create the ViewModelProvider for that drawer, let's call it HomeViewDrawer, and create a model and view for it and nest it in my main, will the architecture cause problems since there are nested models? For example, in my HomeViewDrawer, I may use NavigationService to logout of the app using model.logout. However, that creates a tree of model calls (as in the HomeView, model refers to something else). Does the architecture enable this?

ericjubber