3 difficulties when I switched my state management from BloC to Riverpod in Flutter

3 difficulties when I switched my state management from BloC to Riverpod in Flutter

Hello everyone. In this Medium article, I’m gonna talk about 3 difficulties when I switched my state management from BloC to Riverpod.

First things first, I need to say I develop applications for approximately 2 years in the Flutter section. Sometimes I write articles for applications that are useful for people who want to use already built applications like phone number sign-in or normal sign-in, maybe sometimes UI applications (e-commerce, podcast, etc.). When I developed these applications, and also for 2 years, I used BloC/Cubit state management solutions for the applications. It was a great experience for me. Recently, using Riverpod’s own documentation, I switched my state management solution. In this article, I will tell you what did my expectations, and what did I do.

1. Lots of Provider types

Actually, before the bloc, I wanted to use Providers for the state management, but I could not, since there are lots of Providers, such as Provider, FutureProvider, StreamProvider, etc. Of course, these are the basics, but before the 2 years, I had no idea about them, or in the other words, I did not know the process, I just built basics apps. When I felt to switch, there is a Riverpod, which is also a provider. My aim was to learn providers first, and after that, I wanted to switch to other sections. So, firstly, since I know the BloC/Cubit strongly, I did not look at the state management process. I just glanced at how can I use providers, what is the syntax for providers, how can I reach my variable, when I need to use Provider, FutureProvider, etc. All of them are explained in the official Riverpod documentation, so I looked at the official website (riverpod.dev). After I got a general idea, it was time to use the power of the Riverpod for me.


2. Different syntaxes

In Riverpod, there are different text types, both when calling the functions, and when using the states. In bloc, we have to use context to reach BloC or Cubit, but in the Riverpod, we do have not to reach context, since logic three is outside of the Flutter.


3. Documentation

I told you above, Riverpod has nice documentation. Yes, it is, actually. In my opinion, there is a problem after learning Riverpod. When I started learning BloC, there were lots of examples on BloC’s own page. Also, they have their own tutorial for these projects. But in the Riverpod, there are nice examples without the tutorials. Also when I looked the YouTube, I could not find a nice tutorial for it. So, the documentation is good, but not enough I think. It will be improved I think, since the new developers who start the Riverpod, can feel hard to build some things.

In this article, I talked about my experiences. Using Riverpod, I create applications that are NOT counter app, since there are lots of counter app. I have already built 2 applications which are a to-do app and an API-Search app. Also, when I looked on the internet, I could not find nice resources for the StateNotifier + Riverpod + Freezed + DDD (architecture).

Boris Bokan

@BokanBoris Intermediate - Flutter developer

2 年

Very nice.. And what is the best option for you... BLoC or Riverpod? ??

要查看或添加评论,请登录

Abhinav Srivastava的更多文章

  • Are you tired of deploying flutter app on stores again and again?

    Are you tired of deploying flutter app on stores again and again?

    Often apps need to do changes after deploying sometimes to fix bugs sometime to add new features, but the process of…

  • Understanding the Business Implications of ChatGPT and Large Language Models (LLMs)

    Understanding the Business Implications of ChatGPT and Large Language Models (LLMs)

    Four guiding principles to lead your organization through LLM change “ChatGPT represents an urgent strategic priority…

  • Google Play Console Update: Everything You Must Know

    Google Play Console Update: Everything You Must Know

    You may use the Google Play Console to upload an Android app or game, create a store listing, and publish it. But did…

  • Ethical Hacking

    Ethical Hacking

    What is Ethical Hacking? Hacking news regularly sends shock waves through the business community and everyday consumers…

  • Big hikes in IT set to fade out

    Big hikes in IT set to fade out

    Record salary hikes of 70-100% in the IT sector are expected to normalise between 9% and 12% by FY24, according to IT…

  • Dart: Mixins

    Dart: Mixins

    Mixins are reusable pieces of code that can be brought into another class or mixin. In Swift they are called protocols;…

  • Google’s New Programming Language is Called Carbon. Google Introduced Carbon to be a Successor of C++.

    Google’s New Programming Language is Called Carbon. Google Introduced Carbon to be a Successor of C++.

    Google’s New Programming Language is Called Carbon. Google Introduced Carbon to be a Successor of C++.

  • Google Pay in Flutter

    Google Pay in Flutter

    What is Google Pay? Google Pay (known as G Pay) is a digital wallet platform and online payment system developed by…

  • MASON

    MASON

    Mason is an open source tool that generates code from custom templates called bricks. It can be helpful for developers…

  • Exploring Threading In Flutter !!!

    Exploring Threading In Flutter !!!

    In this article, We are going to learn about Threading In Flutter. Flutter applications start with a single execution…

社区洞察

其他会员也浏览了