Fireship · @fireship

Flutter Provider - Advanced Firebase Data Management

Uploaded May 17, 2019 · Length 11:08

Flutter Provider - Advanced Firebase Data Management

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.

  1. 0:00

    [Music]

  2. 0:06

    one of the most challenging aspects of

  3. 0:08

    building an interactive app is

  4. 0:10

    controlling the flow of data that's why

  5. 0:12

    you might often hear developers debate

  6. 0:13

    over best practices around state

  7. 0:15

    management and while flutter and

  8. 0:16

    firebase both provide some awesome tools

  9. 0:18

    to work with reactive real-time data

  10. 0:20

    it's still not easy in today's video I

  11. 0:22

    want to show you some of my favorite

  12. 0:24

    patterns for apps that have complex data

  13. 0:26

    flow needs with things like firebase

  14. 0:29

    authentic cited to show you how a

  15. 0:31

    library called provider can dramatically

  16. 0:33

    reduce the complexity of your code if

  17. 0:35

    you're new here like and subscribe and

  18. 0:37

    you can find the full source code on

  19. 0:38

    fire ship i/o and I should also mention

  20. 0:40

    that I just recently released my own

  21. 0:42

    flutter app on iOS and Android it allows

  22. 0:44

    you to take quizzes along with my

  23. 0:45

    youtube videos as well as my full

  24. 0:47

    flutter course which was just released a

  25. 0:49

    couple days ago part of the course is

  26. 0:50

    free but consider becoming a pro member

  27. 0:52

    to get the full experience now when it

  28. 0:54

    comes to state management with flutter

  29. 0:55

    and firebase

  30. 0:56

    I've tried a whole bunch of different

  31. 0:57

    approaches and there are a lot of

  32. 0:59

    different solutions that work so it

  33. 1:00

    often just comes down to the developers

  34. 1:02

    preference so let me give you an idea of

  35. 1:04

    some of the things that I really value

  36. 1:05

    on the subject first I want a good

  37. 1:08

    separation of concerns from the business

  38. 1:10

    logic and presentation logic in other

  39. 1:12

    words I don't want to have a whole bunch

  40. 1:13

    of logic related to the retrieval of

  41. 1:15

    data embedded somewhere in the widget

  42. 1:16

    tree the second thing I value is being

  43. 1:19

    able to share data easily throughout the

  44. 1:21

    widget tree I might need to access my

  45. 1:23

    firebase user in 10 different screens

  46. 1:24

    and I definitely don't want to be

  47. 1:25

    listening to a stream manually in 10

  48. 1:27

    different state full widgets and third I

  49. 1:30

    like to try to avoid boilerplate code

  50. 1:31

    there's a lot of really good and popular

  51. 1:33

    state management solutions out there but

  52. 1:35

    they tend to require a lot of

  53. 1:36

    configuration and in most cases I just

  54. 1:39

    prefer to have simple conventions over

  55. 1:41

    explicit configuration now the provider

  56. 1:43

    package for flutter does a really good

  57. 1:45

    job of meeting my needs and all three of

  58. 1:47

    these areas and all it really does is

  59. 1:48

    provides syntactic sugar for inherited

  60. 1:50

    widget as well as some other low-level

  61. 1:52

    building blocks and flutter like stream

  62. 1:54

    builder and change notifier it allows

  63. 1:56

    you to expose a value or as we'll see in

  64. 1:57

    this video a stream and then access the

  65. 1:59

    value in any of the descendant widgets