![]() state_notifier_test: A testing library that makes it easy to test StateNotifier.bloc_test: Testing library, which makes it easy to test blocs.connectivity_plus: Flutter plugin for discovering the state of the network (WiFi & mobile/cellular) connectivity on Android and iOS.flutter_riverpod: A simple way to access state from anywhere in your application while robust and testable.equtable: Dart package that helps implement value-based equality without needing to override explicitly = and hashCode. ![]() flutter_bloc: The Flutter package makes it easy to integrate blocs and cubits into Flutter.dio: A powerful HTTP client for Dart, which supports Interceptors, Global configuration, FormData, Request Cancellation, File downloading, Timeout, etc.The random fact will then be returned and displayed on a card. By pressing the first button, we will demonstrate state management using Riverpod, and by pressing the second button state management using Bloc.Ĭreate a new Flutter application and add required dependencies in pubspec.yaml file. The main idea is to compare Bloc and Riverpod and see their similarities and dierences. We will use a Random Fact API, and every time we press the buttons the API will be called. In this blog, we will cover the basics of Bloc and Riverpod on a simple fetch data from the API example and see how they simplify state management. When working on complex and large production applications, it is crucial to choose a proper state management solution to make the application respond to the user accordingly and to be able to keep track of every change inside the application. There are many state management solutions, and deciding which one to use can be overwhelming, especially to someone relatively new to Flutter or without much experience. State management is simply a solution that takes care of the changes that occur in the application.
0 Comments
Leave a Reply. |