skip to Main Content

I am new to bloc concept. I am trying to get a good understanding on blocprovider and repositoryprovider or the difference between the two. I have been reading blogs but nothing gives a good concrete difference between the two with any examples. Can someone help?

2

Answers


  1. For Blocs you should use BlocProvider because they call the close method automatically when disposing.

    For all other classes you can use RepositoryProvider or Provider from the provider package directly. The difference between RepositoryProvider and Provider is purely semantic. It is intended that you use a RepositoryProvider for a repository, but Provider does exactly the same thing.

    Login or Signup to reply.
  2. You can find examples in the bloc documentation

    in addition look here discussion in bloc github issues.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search