bizz84 / firebase_auth_demo_flutter

Reference Authentication Flow with Flutter & Firebase
https://codewithandrea.com/
MIT License
674 stars 178 forks source link

how do you add multiple provider #22

Closed premtemp1 closed 5 years ago

premtemp1 commented 5 years ago

Hello, Thanks for the article... How do you add multiple provider,,, Suppose , I have another provider name shopping that I also need down stream...

Thanks

bizz84 commented 5 years ago

@premtemp1 sorry for the late reply.

One way to do this is to use a MultiProvider.

Example:

MultiProvider(
  providers: [
    Provider<Foo>.value(value: foo),
    Provider<Bar>.value(value: bar),
    Provider<Baz>.value(value: baz),
  ],
  child: someWidget,
)

Another example is the current main.dart file:

https://github.com/bizz84/firebase_auth_demo_flutter/blob/master/lib/main.dart

Hope this helps.