Coder Social home page Coder Social logo

example for StreamProvider about riverpod HOT 9 CLOSED

rrousselgit avatar rrousselgit commented on August 21, 2024 2
example for StreamProvider

from riverpod.

Comments (9)

rrousselGit avatar rrousselGit commented on August 21, 2024 8

I'm finishing #39 first, which will make documenting providers easier.
Then I'll document all providers individually.

from riverpod.

AlexHartford avatar AlexHartford commented on August 21, 2024 5

I strongly agree. I really love your libraries but it takes me some time to figure out how to use them optimally due to lack of examples. Even something simple would go a long way. That said, I plan to share some of the things I come up with.

from riverpod.

rrousselGit avatar rrousselGit commented on August 21, 2024 4

For firebase you will want to use AutoDisposeStreamProvider, to stop the subscription ASAP when the UI doesn't use the value anymore

from riverpod.

logemann avatar logemann commented on August 21, 2024 4

I think it would be super nice to have little code example inside the API doc like with https://pub.dev/documentation/riverpod/latest/riverpod/StateNotifierProvider-class.html. Would speed up adoption drastically.

And to me its not clear how to handle the types when constructing the provider as well as with the caller of the hook useProvider(firebaseAuthProvider)

from riverpod.

AlexHartford avatar AlexHartford commented on August 21, 2024 2

Tying together the above comments with the newly introduced syntax:

StreamProvider.autoDispose((ref) => FirebaseAuth.instance.onAuthStateChanged)

Thanks for the updates Remi!

from riverpod.

rrousselGit avatar rrousselGit commented on August 21, 2024 1

The syntax changed a bit recently, yes.
But AutoDisposeStreamProvider and StreamProvider.autoDispose are strictly equivalent.

from riverpod.

logemann avatar logemann commented on August 21, 2024

good hint. Wasnt aware of the class alltogether ;-)

from riverpod.

logemann avatar logemann commented on August 21, 2024

@AlexHartford so AutoDisposeStreamProvider is already outdated and one should use StreamProvider.autoDispose() ?

from riverpod.

logemann avatar logemann commented on August 21, 2024

thanks. Just noticed that i wasnt on latest version.

from riverpod.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.