@@samuelnihoul3159 You can put null in the initial data if there isn't cached data you want to load on init. Especially for authentication you want it to return null unless there is a logged in user.
This way of teaching (presenting a problem and solution) about something like a third-party package is SO good. I hate it when tutorials just throw stuff and say "use it" and don't explain why can't I just use built-in stuff, which is often much easier to understand as a beginner. Thank you!
This was a great tutorial! Given its success, I think you should definitely come out with an updated version! Almost everything is outdated and/or deprecated.
You are a fast talker and alway paste the code instead of typing. But your videos are absolutely informative and clear! This one was especially helpful to me! Keep up the good work man! Flutter && VueJS && Firebase all the way.
you can slow down the video to 25%. then watch it at 50% then at full speed. typing wastes time. Im just grateful his english is crystal clear, as the subject matter already demands your full attention. a lot of other fluffer channels fail miserably at this.
As a game development company, trying to get to the app dev zone for our clients, we find your channel great! Coming from a .Net background angdbeing a small company, we decided to use Dart and flutter, mainly for the great merging of Composition ant OOP. .. Please Conceder on doing a video about end 2 end encryption on firestore data, as this is the most important not covered topic out there... and apis like Virgil are too expensive for small companies and individual devs and using user password as a encryption key prevents the data to persiston password changes. Here in Europe, with new personal data laws, firestore is useless without the ability to encrypt data. Continue your great job!All the best from Greece!
Im in the 7:07 minute mark and i stopped the video just to say that this video is very awesome!! I didnt know that there was the spread operator, good stuff!! Amazing video so far
@@Fireship Seriously, I was about to head down the nested widget stream road you talk about, and this video was a revelation for solving that issue. I worked through your Firestore/Angular series before discovering your stuff on Flutter and started to try to teach myself that, and this is by *far* the most comprehensive "advanced concepts" channel out there
Thank you for your great tutorials. It would be nice if you had a simpler introduction to Flutter Provider. It would be very similar to this tutorial, except: a) Don't base the tutorial needing a server-side resources. Maybe reading a local config file would be a simpler way to get params that are needed by different widgets in the app; b) skip discussion of other Flutter state management techniques or their history. That topic is better suited for an update to your Flutter state management Grand Tour tutorial.
This knowledge share is pretty incredible. Getting started with Flutter is easy, but the "ok, I'm going to build a real app" part is still evolving to say the least. Choosing a state mgt and dependency injection solution is coming along (Thank you Remi Rousselet!). But how does one approach client-server communication in a real-world app that uses Firebase? Where is your source of truth for the data model? Where do you keep global state? ...and on and on. So many questions. Great answers here.
@@Fireship Using BLoC right now so that I can call a function from the BLoC to update other UI when data is updated in Firestore. Is this something that is possible with Provider? Edit: Using provider now and replaced the way I provide my BLoCs. Really cleans up the code!
I learn about this package in the Pragmatic state management session of the Google IO. This is great, now, I don't see the point to use such things as BloC for state management. Provider make it easier, and reduce boilerplate.
Thank you so much! You have such a nice way to write clean code eventhough some things getting quite complex! You helped me alot and I was able to save a lot of boiler plate code!
When putting your StreamBuilders inside of providers: [] in MyApp, change it from stuff(lazy to type it).value(stream: FirebaseAuth.instance.onAuthStateChange) to stuff(lazy to type it).value(value: FirebaseAuth.instance.onAuthStateChange) This is because when provider moved to v3 they broke a bunch of stuff from the previous version. You can look into it in more detail on their Github repo's readme
Hey can you share which VS Code Theme are you using? I can't seem to find the exact same one and I like the color scheme, it's easy on the eyes and the contrast is good.
Great video! I was wondering though, if, let's say I have 1000 documents in a collection, for each time I call Provider.of in a new screen Firebase will count it as 1000 reads?
I enjoy and use many of your patterns! However when abstracting with Collection , how can I pass arguments that makes me apply where- or orderBy-rules?
When you setup your StreamProvider with the onAuthStateChanged, I notice that for a brief moment during the app's startup, that the value provided is null. How can you implement a loading page to appear when you only have null or not null to test with in the child widgets?
stream provider asks for 'initialData', when I hot restart, the child widgets take the 'initialData' instead of the most recent data from the stream. I want it to take the most recent data instead of the value given in InitialData. Anyone knows how I can do that?
Great video. Quick question, is it possible to run calculations using a StreamBuilder as a class and then access the output of those calculations as Provider? Rather than run the repeat calculations at each required part of the app.
Would you say that StreamProvider is a resource expensive way to manage state as compare to say ChangeNotifierProvider? In your example you listen to a User stream which is cool because if anything is changed in Firestore it is immediately updated in the app. However, this seems to me like it would be a fairly resource intensive (battery, wifi, data xfer) way listening to the database for changes that may not really be all the frequent. Should StreamProvider with regards to data in Firestore be reserved for things that require instant updates (like notifications for example) while data that doesn't change too often be handled by ChangeNotifierProvider. Thoughts?
What if the Firebase User changes it's display name suddenly.. will it be updated automatically by the Stream or you'll have to manually refresh the FirebaseUser?
I have a question about listening to firebase changes via streams... Is it possible this approach to be more expensive than implementing some time based or manual refresh method? Especially on apps with a large userbase? I mean, if a user remains for a long time to the same page that makes the dispose method useless..
But isn’t provider still highly tied business logic with widget tree? For example, when we have to put widget in the child of Multiprovider? When the app scale up or we have to move widget and functionally around, there’s still a lot of refactoring to do, unless we put the multiprovider at the very top of the widget tree?
That is true, but you need some way to tell the framework where its data dependencies are located. I think Provider does this in a way the fits the ergonomics of Flutter well.
I refactored my code from using Redux to BlocProvider and now I need to refactor again with Provider :-) ha.. but the Provider seems better than my current solution,,, only if it scales well.
@fireship this is a real thing. The syntax changed with the update and the blogpost isn't up-to-date anymore. I think that can be fixed within 10min work?
@@ChristianJosephs agreed, its completely different, although the readme does guide you through the transition, it could be a bit confusing for flutter/dart beginners @fireship please try to fix this.
Sir,I am using grid view builder to load images from friestore, when I scroll down images are again loading, I also tried cached network image but it not worked,how to solve this problem?? Can you help me??
Hey @Fireship, Do you think Cloud Firebase is capable of replace an database architecture composed with some tables (I'm using Postgres) that have many-to-many relationships? Those relationships frequently have many-to-many between 3 tables.
It's probably possible, but might not be practical. Sometimes it's better to duplicate or partially migrate the data you want in Firebase. Every case is different.
In your "Flutter" playlist, videos 8, 9 and 10 look to all be the same: "Flutter Provider - Advanced Firebase Data Management". you might want to take a look at that and clean it up if i'm right... or not....
You never know the knowledge you will need in the future... For example I could have never thought than knowing the channel milleaccendini would have helped me with flutter development.
I'm trying to implement this, but getting the following error at this line: StreamProvider.value Error: "The class 'StreamProvider' doesn't have a constructor named 'value'." Could someone possibly explain what I'm doing wrong? Will really appreciate it!
The method 'map' was called on null. Receiver: null Tried calling: map(Closure: (Weapon) => Card) This is the error that i am getting when trying to use your tutorial. Please helpp.
Can i ask you something . how does the WeaponList find the weapons weapons = Provider.of(context); and you didnt evil put that stream in the multi provider
They serve different purposes, I actually use provider in combination with RxDart. Rx is useful when you need specialized control flow over the stream itself.
I still don't get all those state management providers, why not only use a StreamBuilder? You have to write lots more to code to achieve the same result with the other solutions.
Provider does not require extra boilerplate. It's actually less code than StreamBuilder (in fact, its syntactic sugar for it) because it manages the subscriptions for you, so you can treat the emitted value as if it were synchronous
Awesome tips and tricks! Keep the good work! There is a new version of the library (now 3.0.0) at pub.dev/packages/provider, and Provider now throws if used with a Listenable or a Stream. We can disable it with Provider.debugCheckInvalidValueType = null;
Can you pretty please make an updated version of this video? :)
Yes, it's unclear how to setup the StreamProvider now :( It requires a value and an initial data but what do we put in initial data?
@@samuelnihoul3159 You can put null in the initial data if there isn't cached data you want to load on init. Especially for authentication you want it to return null unless there is a logged in user.
This way of teaching (presenting a problem and solution) about something like a third-party package is SO good. I hate it when tutorials just throw stuff and say "use it" and don't explain why can't I just use built-in stuff, which is often much easier to understand as a beginner. Thank you!
This was a great tutorial! Given its success, I think you should definitely come out with an updated version! Almost everything is outdated and/or deprecated.
Please make an updated version of this video.
BTW, I love all your videos, they are crisp and clear, and you are always straight to the point.
Excellent timing with suggesting Provider ... since at Google IO 2019 that is what was recommended. You got skillz.
Does provider work with BLOC, or is that an alternative approach?
@@TwistedDestroyer99 good question, anyone has answers?
You are a fast talker and alway paste the code instead of typing. But your videos are absolutely informative and clear! This one was especially helpful to me! Keep up the good work man! Flutter && VueJS && Firebase all the way.
you can slow down the video to 25%. then watch it at 50% then at full speed. typing wastes time. Im just grateful his english is crystal clear, as the subject matter already demands your full attention. a lot of other fluffer channels fail miserably at this.
Wow, that factory Class.fromMap trick is totally awesome. I can't believe I've been struggling to create classes from maps All this time
I know we need this, but is there any way we can automatically deserialize from map to object?
"Beer. Temporary solution." - If i wasn't already subscribed that would make me subscribe right there lol
I promise to buy the advance course, as the basic intros have helped me land jobs in flutter
So far the best tutorial to learn the provider. 1000Likes from me
Top quality content! thanks Jeff
Thank you Sergey
Ma name a jeff! 🤣🤣🤣 #22jumpstreet
As a game development company, trying to get to the app dev zone for our clients, we find your channel great! Coming from a .Net background angdbeing a small company, we decided to use Dart and flutter, mainly for the great merging of Composition ant OOP. ..
Please Conceder on doing a video about end 2 end encryption on firestore data, as this is the most important not covered topic out there... and apis like Virgil are too expensive for small companies and individual devs and using user password as a encryption key prevents the data to persiston password changes.
Here in Europe, with new personal data laws, firestore is useless without the ability to encrypt data.
Continue your great job!All the best from Greece!
Im in the 7:07 minute mark and i stopped the video just to say that this video is very awesome!! I didnt know that there was the spread operator, good stuff!! Amazing video so far
The gif in the intro keeps distracting me. hahahahahaha. Now I can write less code for the same results. Very grateful Sir Jeff.
holy crap this is a good one hahah you are the best Firebase resource on the web dude, and the flutter stuff is also the best out there
Thank you Jason!
@@Fireship Seriously, I was about to head down the nested widget stream road you talk about, and this video was a revelation for solving that issue. I worked through your Firestore/Angular series before discovering your stuff on Flutter and started to try to teach myself that, and this is by *far* the most comprehensive "advanced concepts" channel out there
Thank you for your great tutorials.
It would be nice if you had a simpler introduction to Flutter Provider. It would be very similar to this tutorial, except:
a) Don't base the tutorial needing a server-side resources. Maybe reading a local config file would be a simpler way to get params that are needed by different widgets in the app;
b) skip discussion of other Flutter state management techniques or their history. That topic is better suited for an update to your Flutter state management Grand Tour tutorial.
This knowledge share is pretty incredible. Getting started with Flutter is easy, but the "ok, I'm going to build a real app" part is still evolving to say the least. Choosing a state mgt and dependency injection solution is coming along (Thank you Remi Rousselet!). But how does one approach client-server communication in a real-world app that uses Firebase? Where is your source of truth for the data model? Where do you keep global state? ...and on and on. So many questions. Great answers here.
Great video, will have to check out Provider soon 🤔
It's really underrated, I've been enjoying it!
@@Fireship Using BLoC right now so that I can call a function from the BLoC to update other UI when data is updated in Firestore. Is this something that is possible with Provider?
Edit: Using provider now and replaced the way I provide my BLoCs. Really cleans up the code!
@Robert Brunhage , what you mean? Using provider with bloc pattern??
@@RobertBrunhage can you please elaborate a bit?
Would you cover using other backend like node.js with flutter? Thank you for all the flutter tutorial. I'm buying your course!
Yes I would consider that. Dart has a good HTTP package and I've also been thinking about a graphql vid for other backends.
@@Fireship Graphql would be awesome!
Node plz also would like golang
I learn about this package in the Pragmatic state management session of the Google IO. This is great, now, I don't see the point to use such things as BloC for state management. Provider make it easier, and reduce boilerplate.
That was a good talk. I like the flexibility of Provider and you can even use it to roll out your own Bloc-style solutions.
I was just watching google I/O about provider and boom , you post this
please make an updated version...... A must watch for flutter developers
I love the last tip!!
Thank you so much! You have such a nice way to write clean code eventhough some things getting quite complex!
You helped me alot and I was able to save a lot of boiler plate code!
That's awesome thanks for sharing this part,
Peak Video tutorial for flutter
BLOC or PROVIDER ? what is better in 2021?
For me it's provider
Because i only.know that not the bloc pattern
Provider is definitely better and easier but a lot of recruiters are looking for developers with BLOC experience
Great video Jeff! I definitely like this better than Bloc for my use cases. Do you plan on covering Flutter testing in the future?
Yes, testing in one my video list, but no exact timeline yet...
When putting your StreamBuilders inside of providers: [] in MyApp, change it from
stuff(lazy to type it).value(stream: FirebaseAuth.instance.onAuthStateChange) to
stuff(lazy to type it).value(value: FirebaseAuth.instance.onAuthStateChange)
This is because when provider moved to v3 they broke a bunch of stuff from the previous version. You can look into it in more detail on their Github repo's readme
you are a god, was trying to figure out what the deal was
// ! Provider CheatSheet
// Step 1: Create Model class
class Counter extends ChangeNotifier {
int count = 0;
void increase() {
count++;
notifyListeners();
}
}
// Step 2: Wrap root widget in MultiProvider, Also initialise Counter() here
MultiProvider(
providers: [
ChangeNotifierProvider(create: (_) => Counter()),
],
child: MaterialApp(),
)
// Step 3: Read value
final count = Provider.of(context).count;
// Step 4: Write value
Provider.of(context, listen: false).increase();
You are hero of flutter-er
Hey can you share which VS Code Theme are you using? I can't seem to find the exact same one and I like the color scheme, it's easy on the eyes and the contrast is good.
i will be the luckiest guy to work with you on flutter and i m Sure that will be everything to learn everything...
Great video! I was wondering though, if, let's say I have 1000 documents in a collection, for each time I call Provider.of in a new screen Firebase will count it as 1000 reads?
I enjoy and use many of your patterns!
However when abstracting with Collection , how can I pass arguments that makes me apply where- or orderBy-rules?
Thank you Jeff. I love your videos.
YOU SIR..... are a legend
Are you coming out with a Flutter for beginners course soon or just the Flutter Firebase course for now?
so amazing !! this is what I was waiting for thank you !! :)
Thanks a lot for the explanation, I want to be like you one day 💪
Excellent tutorial. Thank you!
When you setup your StreamProvider with the onAuthStateChanged, I notice that for a brief moment during the app's startup, that the value provided is null. How can you implement a loading page to appear when you only have null or not null to test with in the child widgets?
que buena chamba compañero. good
How can you use the Realtime Database instead of Firestore?
Hi What to do when stream provider is called on null when The. Collection is not created yet
Can you talk about more in depth on all the providers options like providers stream ect...
Thank you for this video.
It really helped me solved a big problem with my app
Glad to hear that, provider solved many of my problems
stream provider asks for 'initialData', when I hot restart, the child widgets take the 'initialData' instead of the most recent data from the stream. I want it to take the most recent data instead of the value given in InitialData. Anyone knows how I can do that?
Great video. Quick question, is it possible to run calculations using a StreamBuilder as a class and then access the output of those calculations as Provider? Rather than run the repeat calculations at each required part of the app.
Hello could you tell me if possible how to handle errors in stream provider. thnks
Hmm I just created some classes to feed the data from firebase firestore to my widgets
Would you say that StreamProvider is a resource expensive way to manage state as compare to say ChangeNotifierProvider? In your example you listen to a User stream which is cool because if anything is changed in Firestore it is immediately updated in the app. However, this seems to me like it would be a fairly resource intensive (battery, wifi, data xfer) way listening to the database for changes that may not really be all the frequent. Should StreamProvider with regards to data in Firestore be reserved for things that require instant updates (like notifications for example) while data that doesn't change too often be handled by ChangeNotifierProvider. Thoughts?
What if the Firebase User changes it's display name suddenly.. will it be updated automatically by the Stream or you'll have to manually refresh the FirebaseUser?
good question. did you figure out?
@@Lensbreak yes I did :)
can you explain the difference between the streamprovider and streamprovider.value constructors? its hard to find anywhere.
simple but implementation is very complex.
I have a question about listening to firebase changes via streams... Is it possible this approach to be more expensive than implementing some time based or manual refresh method? Especially on apps with a large userbase? I mean, if a user remains for a long time to the same page that makes the dispose method useless..
But isn’t provider still highly tied business logic with widget tree? For example, when we have to put widget in the child of Multiprovider? When the app scale up or we have to move widget and functionally around, there’s still a lot of refactoring to do, unless we put the multiprovider at the very top of the widget tree?
That is true, but you need some way to tell the framework where its data dependencies are located. I think Provider does this in a way the fits the ergonomics of Flutter well.
Please tell, from where you are learning all of these because I am not able to learn from docs. So please tell us your sources to learn?!
Wow so good content. thank you
I refactored my code from using Redux to BlocProvider and now I need to refactor again with Provider :-) ha.. but the Provider seems better than my current solution,,, only if it scales well.
wait.. how do you change the value (state)?
Can you update this or the blog post to v3 of provider, there are some subtle differences such as different parameter names and etc.
@fireship this is a real thing. The syntax changed with the update and the blogpost isn't up-to-date anymore. I think that can be fixed within 10min work?
@@ChristianJosephs agreed, its completely different, although the readme does guide you through the transition, it could be a bit confusing for flutter/dart beginners @fireship please try to fix this.
Sir,I am using grid view builder to load images from friestore, when I scroll down images are again loading, I also tried cached network image but it not worked,how to solve this problem?? Can you help me??
one year and still here
I still cant make the connection between the user, superhero and weapons. where did the users come in the picture?
can we have a vidoe for many-to-many relationships using this logic?? thanks
I've been playing with provider, seems to be the next thing
Hey @Fireship, Do you think Cloud Firebase is capable of replace an database architecture composed with some tables (I'm using Postgres) that have many-to-many relationships? Those relationships frequently have many-to-many between 3 tables.
It's probably possible, but might not be practical. Sometimes it's better to duplicate or partially migrate the data you want in Firebase. Every case is different.
why we using the factory consturctor why not a simple function?
How can i Provide 2 streams in the MultiProvider array with one dependent on the other?
Please can you make a video on how to retrieve double value or geo point from firebase
Thank you very much for your videos. Could you answer - what's the font in your VS Code that you use?
I think it is "Fira Code".
Is there an option to buy the flutter course alone without a subscription?
just curious what plugins are you using in the VS code editor, they are looks awesome, could you share the plugins?
I will make a video that reveals all this stuff very soon :)
please do this video again but with riverpod
How can you update the data from a widget that uses Provider.of?
In your "Flutter" playlist, videos 8, 9 and 10 look to all be the same: "Flutter Provider - Advanced Firebase Data Management". you might want to take a look at that and clean it up if i'm right... or not....
Is multi provider share data between multiple pages?
You never know the knowledge you will need in the future... For example I could have never thought than knowing the channel milleaccendini would have helped me with flutter development.
Love it!
Great vid!!
I'm trying to implement this, but getting the following error at this line:
StreamProvider.value
Error: "The class 'StreamProvider' doesn't have a constructor named 'value'."
Could someone possibly explain what I'm doing wrong? Will really appreciate it!
Ah, had to update the Provider package
The method 'map' was called on null.
Receiver: null
Tried calling: map(Closure: (Weapon) => Card)
This is the error that i am getting when trying to use your tutorial. Please helpp.
Timestamp from this video?
Can i ask you something . how does the WeaponList find the weapons weapons = Provider.of(context);
and you didnt evil put that stream in the multi provider
I am confused also
did you find solution?
@@gmmkkgmmkk6168 No just waiting for his answer maybe he can explain how the cycle goes or we are missing something
What is your email?
what you prefer to use? provider or rxdart ?
They serve different purposes, I actually use provider in combination with RxDart. Rx is useful when you need specialized control flow over the stream itself.
Hey Jeff, how do you get those emojies in your IDE and in Firestore?
They are actually just strings so you can simply copy/paste them emojipedia.org/
Great vid.
I have a question... Can I contact you directly?
I still don't get all those state management providers, why not only use a StreamBuilder? You have to write lots more to code to achieve the same result with the other solutions.
Provider does not require extra boilerplate. It's actually less code than StreamBuilder (in fact, its syntactic sugar for it) because it manages the subscriptions for you, so you can treat the emitted value as if it were synchronous
Fireship Oh I didn't catch that synchronous thing, that is actually pretty useful stuff.
wow... it's interesting to see how dart has changed dramatically in last Frew years... Now it always Buggs me to add const modifier and null check...
How do I Implement my isEmailVerified using provider
what is factory return type in SuperHero?
@Fireship can you make a video flutter app deployment both on ios and android? And other lisencing stuff that goes with it!
I may do that in the future, but I cover the deploy process in the full course for both google play and apple.
Awesomeness!
Please cover svelte and firestore :)
Flutterfire 🦄
hey! any thoughts on fish redux?
Great!
You're sharing Dart 2.3 cool tips but almost every others are outdated like provider and FirebaseAuth versions. ':(
Awesome tips and tricks! Keep the good work! There is a new version of the library (now 3.0.0) at pub.dev/packages/provider, and Provider now throws if used with a Listenable or a Stream. We can disable it with Provider.debugCheckInvalidValueType = null;
Jeff at 0:11 : Introducing video's content
Italians: th-cam.com/video/59L51yWUFiQ/w-d-xo.html
This video is fully deprecated and doesn’t work now