Fireship · @fireship
Flutter Provider - Advanced Firebase Data Management
Uploaded May 17, 2019 · Length 11:08
Summary
Flutter Provider library simplifies Firebase data management by exposing streams and values throughout the widget tree, reducing boilerplate code and improving type safety.
- flutter provider
- firebase data management
- state management
- stream builder
- inherited widget
- dart development
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
[Music]
- 0:06
one of the most challenging aspects of
- 0:08
building an interactive app is
- 0:10
controlling the flow of data that's why
- 0:12
you might often hear developers debate
- 0:13
over best practices around state
- 0:15
management and while flutter and
- 0:16
firebase both provide some awesome tools
- 0:18
to work with reactive real-time data
- 0:20
it's still not easy in today's video I
- 0:22
want to show you some of my favorite
- 0:24
patterns for apps that have complex data
- 0:26
flow needs with things like firebase
- 0:29
authentic cited to show you how a
- 0:31
library called provider can dramatically
- 0:33
reduce the complexity of your code if
- 0:35
you're new here like and subscribe and
- 0:37
you can find the full source code on
- 0:38
fire ship i/o and I should also mention
- 0:40
that I just recently released my own
- 0:42
flutter app on iOS and Android it allows
- 0:44
you to take quizzes along with my
- 0:45
youtube videos as well as my full
- 0:47
flutter course which was just released a
- 0:49
couple days ago part of the course is
- 0:50
free but consider becoming a pro member
- 0:52
to get the full experience now when it
- 0:54
comes to state management with flutter
- 0:55
and firebase
- 0:56
I've tried a whole bunch of different
- 0:57
approaches and there are a lot of
- 0:59
different solutions that work so it
- 1:00
often just comes down to the developers
- 1:02
preference so let me give you an idea of
- 1:04
some of the things that I really value
- 1:05
on the subject first I want a good
- 1:08
separation of concerns from the business
- 1:10
logic and presentation logic in other
- 1:12
words I don't want to have a whole bunch
- 1:13
of logic related to the retrieval of
- 1:15
data embedded somewhere in the widget
- 1:16
tree the second thing I value is being
- 1:19
able to share data easily throughout the
- 1:21
widget tree I might need to access my
- 1:23
firebase user in 10 different screens
- 1:24
and I definitely don't want to be
- 1:25
listening to a stream manually in 10
- 1:27
different state full widgets and third I
- 1:30
like to try to avoid boilerplate code
- 1:31
there's a lot of really good and popular
- 1:33
state management solutions out there but
- 1:35
they tend to require a lot of
- 1:36
configuration and in most cases I just
- 1:39
prefer to have simple conventions over
- 1:41
explicit configuration now the provider
- 1:43
package for flutter does a really good
- 1:45
job of meeting my needs and all three of
- 1:47
these areas and all it really does is
- 1:48
provides syntactic sugar for inherited
- 1:50
widget as well as some other low-level
- 1:52
building blocks and flutter like stream
- 1:54
builder and change notifier it allows
- 1:56
you to expose a value or as we'll see in
- 1:57
this video a stream and then access the
- 1:59
value in any of the descendant widgets


