Flutter Getx Provider Riverpod and BLoC Which One to Use

Created At: 2022-03-17 00:25:42 Updated At: 2023-09-14 08:45:42

Here is the basic difference Getx, BLoC, Riverpod and Provider and learn which better for your project, cv and growth. I started learning with Getx and I found it's much easier and then learning others from here, make your life easier.

Once you learn Getx very well, you will find it's really easy to learn other state managment libraries. 

I use GetX, Riverpod, BLoC and Cubit all the time. Since I use all of them at work, building youtube tutorials, I can say more about them and also the  provide guide when to use them. My youtube channel is also one of the best of finding resources for all the state management systems.

I don't give bais options like other youtubers.

Getx

1. Easy to learn

2. Covers routing (one of the best routing among the packages in pub.dev)

3. Provide beautiful animation of page or screen transition

4. Http request like get(), post(), delete() and put() method

6. State Management (super simple since you don't need to manage context on your own)

7. Auth Middleware

8. Provides auto dispose of the controllers

9. You can manage Singleton class by extending GetxService

10. Better life cylce management of your screens using onInit(), onReady() and onClose() methods.

With Getx if you know how a controller works and what is obs or where to use update methods you are good to go. Another GetX benefit is that, it manages the life cycle very well which is efficient, cuz when a screen is not needed, GetX can dispose it auto which saves a lot of memeory. This is better than BLoC or Riverpod. By default GetX saves memory since all the UI classes could be stateless class which is also better than BLoC or Riverpod.

Getx syntax and coding style is very classiscal with Java, C# or PHP. It's definitely an option for freelancers and making quick bucks in app building. 

Start with Getx and you will find your app building becomes much faster. You feel satisfied about yourself.

Riverpod

1. Little more difficult than Getx

2. Covers State management (need to manage the context on your own)

3. Easy tool for quick app development

4. State inspection in dev tool

5. Code is relatively readable

6. Latest Riverpod provides code generation for Providers

7. Provides performance optimized method like select()

8. AsyncNotifier providers extra method for network request

9. Manage Singleton classes using Keep alive tag

10. Better error handling with AsyncValue

Riverpod provides different kinds of providers. For beginners a little hard to grasp the content.

Riverpod's syntax style like BLoC or Cubit. For Example when you create StateNotifierProvider, it's same as create a BLoC class. It may also look great on your CV.

Some features used with AsyncValue, which help error handling and data loading much better than GetX or BLoC. All the FutureProviders provide efficient way of data showing on the UI by using when() method. With recent updates providers are auto disposed when a screen is not needed which is more like GetX now.

Recent update with Riverpod 2.0, the idea of choosing providers and managing states became easier. You no longer need to manually create providers. You may auto generate Riverpod providers using code generation tool.

Provider

1. Little more difficult than Getx but eaiser than Riverpod

2. Covers State Management

3. Many Flutter plugins are written in Provider, so it's worth learning.

I think provider is the simplest one, if you just knkow ChangeNotifier, you would acheive a lot.

BLoC

1. Could be a little difficult for beginners (creating states and events could look confusing)

2. Covers state management (need to manage context on your own)

3. Provide great unit test

4. Let's you see the deep into the flutter framework

5. Keeps the code cleaner and redeable

6. It keeps states and events seperate

7. You could store data with Hydrated storage using BLoC or Cubit

8. Provides RepositoryProvider for network request

BLoC is very popular and used in the many earlier apps.  In many aspects you will find BLoC, Provider and Riverpod are very similar. It would make your cv shine if you put that you know BLoC/Cubit. It would also make your cv stand out if you know TDD and Clean Architecture with it.

Now there's something called Cubit. Cubit is a subject of BLoC and easier to use. Let's see the comparison here BLoC or Cubit. With BLoC, you get to see the Flutter framework itself and how the whole framework works. Getx and Riverpod take away many things and do a lot of heavy work for you. But with BLoC you need to do many things on your own gives you better understanding of the framework. 

Riverpod and BLoC they all have state object. Using state object you may access all the properties and fields of a certain class.

See my suggestions how to learn the state management 

See youtube polling results from thousands of followers.

Youtube polling for state management libraries

Getx complete app

BloC complete app

Riverpod complete app

Provider complete app

Comment

Add Reviews