Riverpod or Bloc? Which One is Better?

Поділитися
Вставка
  • Опубліковано 18 січ 2025

КОМЕНТАРІ • 95

  • @RandalLSchwartz
    @RandalLSchwartz Рік тому +98

    I believe bloc is the right choice when you're working on a team of varying skill levels. It has one primary way of distributing events, and everything sorta circles around that. Riverpod offers far more flexibility... but with great power comes great responsibility, and some mastery is recommended. Riverpod can even be used in "bloc" mode with streams if you want... That said, I reach for riverpod for pretty much every project I'm influencing, whether it's a few classes, or a few hundred classes. Riverpod scales well.

    • @VICTORYAIREN
      @VICTORYAIREN 12 днів тому

      Good day sirhow exactly does one learn this state management looking at it seems overwhelming

    • @AetherA11y
      @AetherA11y 9 днів тому +1

      Glad someone else supports Riverpod. Been using it for years. Simple, productive, easy to learn, avoids need to restructure your app on every change. Bloc has twice as many likes... why? Follow the money? It's like a favorite flavor of ice cream. Is someone not going to get hired because they prefer Riverpod to Bloc? Hope not. I'm busy with a bunch of stuff in Rust and Flutter. I don't have time to learn/switch to Block "just because..." Just need to get things done. Bloc just seems overly complicated, and corporations seem to prefer complexity over getting things done.

    • @AetherA11y
      @AetherA11y 9 днів тому

      ... Oh yeah, and flutter_hooks / hooks_riverpod! Love it!

  • @zdenekkrcal9066
    @zdenekkrcal9066 Рік тому +37

    Riverpod is excellent and easier to use now with riverpod annotations.

  • @noursalman932
    @noursalman932 Рік тому +15

    Coming from BLoC (Cubit) background, I actually learned to use Riverpod from this comparison, better than any Riverpod tutorial I came across. Many thanks!

  • @RandalLSchwartz
    @RandalLSchwartz Рік тому +33

    Riverpod *has* a StreamProvider. Most of riverpod has nothing to do with streams, and uses a far simpler but more flexible strategy of ProviderListenables. So the comment mid-video about them both using streams is already wrong. Some of the other things are also marginal.

  • @moisesbinzie
    @moisesbinzie Рік тому +25

    Well explained. With that comparison, I finally understood a bit of Bloc. Coming from Provider, It was easy for me to transtion to Riverpod than Bloc

  • @akshattamrakar9071
    @akshattamrakar9071 Рік тому +23

    Bloc is better as it extracts all the implementation in separate location. It's works great for teams

    • @sahilambure
      @sahilambure Рік тому +6

      It is good for beginner to advance app. But riverpod scales better than BLOc

    • @abrorbobomurodov2361
      @abrorbobomurodov2361 Рік тому +1

      ​@@sahilamburefor team work Bloc would be great choice

  • @conceptcoder
    @conceptcoder Рік тому +20

    It's like "Fireship taste" when see this video... 😎

  • @Quicky121
    @Quicky121 Рік тому +18

    I tried Cubit, BLoC and (sadly) Redux and for me BLoC is the better. It has a clean way to write your business logic and all the Builder, Listener widgets keep your code clean. I read some comments that says that Riverpod scales up better and I'm curious to see if it's true. Maybe an hint for next video? :P
    Thanks for the video!

  • @sharbelokzan9673
    @sharbelokzan9673 Рік тому +3

    I’m experienced with bloc but was a bit confused with riverpod, this helped a lot! Thanks

  • @robbrooks5263
    @robbrooks5263 Рік тому +8

    Explain to me like I'm a 5 year-old why I need to adopt one of these in preference to plain old Provider.
    What am I missing?

    • @TheRealPhillipJacobs
      @TheRealPhillipJacobs Рік тому +1

      Probably just the size of your app.

    • @RandalLSchwartz
      @RandalLSchwartz Рік тому +9

      I've migrated three projects from Provider to Riverpod. Each time, the code get simpler, more robust, and more featureful, and easier to maintain.

  • @sahilambure
    @sahilambure Рік тому +11

    Riverpod is better for big apps.

  • @przemekbemek
    @przemekbemek Рік тому +3

    Great comparison, thanks. I found a minor bug in 1:25 on the right example - "state.user == null" is copy-pasted from the left example, but there's no reference to state actually

    • @flutterguys
      @flutterguys  Рік тому

      Yes you are right, Thank you ❤✌

  • @fegartyx8271
    @fegartyx8271 Рік тому +2

    I'm still confused right now, like many job requirements want to use bloc than riverpod

  • @jointtask
    @jointtask Рік тому +15

    Bloc has a lot of boilerplate code involved, I wound prefer Riverpod

    • @justinprakashraj6256
      @justinprakashraj6256 Рік тому +3

      what is boilerplate ?

    • @baruchfavour9358
      @baruchfavour9358 Рік тому +1

      Much of code could be unnecessary sometimes

    • @justinprakashraj6256
      @justinprakashraj6256 Рік тому +1

      @@baruchfavour9358 thanks BFavour

    • @鄭琮瀚-x2j
      @鄭琮瀚-x2j Рік тому

      How about getx?

    • @Quicky121
      @Quicky121 Рік тому +2

      I don't know man, it has some boilerplate but for events and state you can use freezed library to solve this, resulting in less boilerplate and cleaner code. Give it a try!

  • @MarcelinoDavid111
    @MarcelinoDavid111 9 місяців тому +2

    Riverpod

  • @nicolaimagnussen1914
    @nicolaimagnussen1914 5 місяців тому

    which editing tricks are you using to get this type of editing, any tips?

  • @guycz
    @guycz Рік тому +9

    My opinion - Riverpod

  • @TheRealPhillipJacobs
    @TheRealPhillipJacobs Рік тому +7

    Looks like Riverpod is the winner in the comments. Riverpod it is then!

  • @ragibshahariar3169
    @ragibshahariar3169 2 місяці тому +1

    Hello Flutter guys could you teach us bloc. how to implement it

  • @davisburnside9609
    @davisburnside9609 11 місяців тому

    Why would I want bloc a river as no competing pods are crossing state crosspods?

  • @letmelearnai
    @letmelearnai Рік тому +2

    i only use riverpod now since i found provider lack context control. i'll try bloc when i found lack of riverpod because people said bloc is great for complete separate business logic.

  • @YS_Yousef
    @YS_Yousef Рік тому

    please make the soundeffects lower and get some better ones

  • @site.x9448
    @site.x9448 11 місяців тому

    Wow. Sir, what software do you use for such editing?

  • @h3w45
    @h3w45 7 місяців тому

    Thank you very well explained

  • @pintalubaf
    @pintalubaf Рік тому +3

    The main problem I see with Riverpod is that anyone, from anywhere, can read a notifier and change the state,

    • @flutterguys
      @flutterguys  Рік тому +2

      Riverpod document :
      Do not be frightened by the global aspect of providers. Providers are fully immutable. Declaring a provider is no different from declaring a function, and providers are testable and maintainable.

    • @pintalubaf
      @pintalubaf Рік тому

      @@flutterguys Yeah, providers are immutable, but their states are mutable, and public.
      I'm not saying it's bad, it's just the problem I see.

    • @RandalLSchwartz
      @RandalLSchwartz Рік тому +4

      @@pintalubaf "but their states are mutable, and public.". No, they aren't. You must pass through a function to update the state of a Notifier (sync, Future or Stream). If you're calling that mutable or public, you need to look closer. Perhaps you're thinking of the legacy StateProvider, which was a stopgap introduced to get people at least one step away from globals. But that pattern while still supported, is no longer recommended. Instead, immutable state with defined updating methods is now the primary API.

    • @pintalubaf
      @pintalubaf Рік тому +4

      @@RandalLSchwartz This is actually good news to me, because some months ago I could set the state from anywhere like: `ref.read(randomProvider.notifier).state = newState;`, so at that point, either state was mutable/public or not protected. It's good to see its immutable now. Thank you for letting me know about this.

    • @pintalubaf
      @pintalubaf Рік тому

      Or, it's the legacy StateProvider as you said.

  • @abasilis
    @abasilis Рік тому

    Hi, Excellent video, thanks. At the end you mentioned depends on the scale of the peoject, so, which one to use in a bigger project?

  • @tananga_studio
    @tananga_studio Рік тому +8

    From my expierience riverpod is more elastic. Bloc is good in simple apps

    • @NOBODYxx09
      @NOBODYxx09 Рік тому +8

      No, bloc is the choice for bigger apps believe me i have been there 😉

    • @bouyahyabilel2437
      @bouyahyabilel2437 Рік тому +1

      No , bloc is the great choice for bigger app , also when you work with team

  • @alphaNaj
    @alphaNaj Рік тому +1

    great content you are making, keep it up

  • @algeriennesaffaires7017
    @algeriennesaffaires7017 Рік тому +1

    Even i have been developing with flutter for 4 years, but i can't understand this video. The correct question is, what is the problem block or provider solve, and set State can't do it? Im using set State, and it's good enough

    • @flutterguys
      @flutterguys  Рік тому

      In big apps, you cannot use set state to manage the state, and you need to manage the structured state and avoid complexity.

    • @algeriennesaffaires7017
      @algeriennesaffaires7017 Рік тому +1

      @Flutter Guys thanks, i have a medium-sized app that took me 4 years now to maintain i ts little complicated, yes, but it's well controlled with just set State

    • @bhakinkhantarjeerawat8163
      @bhakinkhantarjeerawat8163 Рік тому +2

      @@algeriennesaffaires7017 Interesting! I really like when people can use simple methods to manage things, especially the old staff, and it still works well.

    • @sangamgiri1071
      @sangamgiri1071 Рік тому

      Yes I have used default setState in bigger projects too but at some point everything starts getting messy so Bloc is recommended

    • @teajay6545
      @teajay6545 Рік тому +2

      I can only imagine the pain and length you have to go through to make your apps conform to using setState only phew 😮‍💨 (I smell anti-pattern)

  • @justinprakashraj6256
    @justinprakashraj6256 Рік тому +2

    BLOC 🔹❤️

  • @dolbysoundsofficial9323
    @dolbysoundsofficial9323 Рік тому +3

    Riverpod

  • @joshuanwokoye
    @joshuanwokoye Рік тому

    Very straight forward!

  • @rsajdok
    @rsajdok Рік тому +1

    riverpod has less boiler plate code

  • @erlangparasu6339
    @erlangparasu6339 Рік тому

    bloc because more recognize with all class contains prefix "Bloc" :)

  • @IncompleteTheory
    @IncompleteTheory Рік тому +2

    Provider FTW.

  • @dadlord689
    @dadlord689 8 місяців тому

    Working for years with Unity and Unreal engines... this is frustrating. You can't over complicate messaging more.

  • @mohamedabdelrehem7698
    @mohamedabdelrehem7698 Рік тому

    are you real
    this video the first of your videos pop to me and now i just watched mostly all of your videos♥♥♥♥

  • @miranantamiangr
    @miranantamiangr Рік тому

    You have to change your voiceover ai to elevenlabs or something slower. It’s very bad and rushed now

  • @TheRealFFS
    @TheRealFFS Рік тому

    You want to go over this any faster pal?

  • @bilal1708
    @bilal1708 10 місяців тому

    I prefer Provider 😅

  • @int-64
    @int-64 5 місяців тому

    Too much coupling and logic in the UI with Riverpod. Bloc provides good abstraction and decoupling

  • @markosunbro2732
    @markosunbro2732 7 місяців тому

    Mobx )))

  • @lmao498
    @lmao498 4 місяці тому

    no thanks, still preferred provider

  • @keithbertschin1213
    @keithbertschin1213 4 місяці тому

    You couldn’t talk any faster could you!

  • @ai_mak354
    @ai_mak354 Рік тому

    GetX!!!))

  • @salmaindrianputri164
    @salmaindrianputri164 Рік тому

    But im with getx

  • @TheKiRBiR
    @TheKiRBiR 23 дні тому

    why do concept like these suck all life out of you and kill your desire to be a developer? Is this what awaits in the corporate world?

  • @AbdulRahim-ok1vs
    @AbdulRahim-ok1vs Рік тому +1

    Riverpod