abstract_bloc 1.4.13
abstract_bloc: ^1.4.13 copied to clipboard
Abstraction for fetching local or remote data via flutter_bloc
abstract_bloc #
abstract_bloc
is a Flutter package that provides a set of abstract base classes to implement the BLoC (Business Logic Component) pattern. It allows for a structured approach to state management, simplifies the creation of reusable components, and promotes maintainable code practices.
📌 Why Use abstract_bloc? #
- ✅ Abstract Base Classes – Standardizes the implementation of Cubits and Blocs, encouraging best practices.
- ✅ Flexible Components – Easily create flexible and reusable components for managing application state.
- ✅ Decoupled State Management – Clearly separate presentation logic from business logic for better maintainability.
- ✅ Rich Functionality – Streamlines handling of common use cases, such as lists and forms.
🚀 Getting Started #
1️⃣ Install the Package #
Add the package to your pubspec.yaml
:
dependencies: abstract_bloc: latest_version
Run:
flutter pub get
Features #
- Load, Refresh and Load more data from cache + network with seamless flow
- Show error widget when network error occures and allow the user to reload the data
- Show info icon telling the user that cached data is being shown and allow them to reload the data
Please refer to the example project for more detailed insight into the usage of AbstractBloc
🛠️ Advanced Use Cases #
- Nested BLoCs: Create nested BLoCs or Cubits to manage complex states in larger applications.
- Reactive Forms: Enhance form handling with reactive state management, leveraging the
AbstractFormCubit
. - Global State Management: Implement a globally accessible state using a combination of Cubits and Blocs.
🏆 Conclusion #
The abstract_bloc
package provides a foundation for building robust and scalable applications using the BLoC pattern. By leveraging abstract classes tailored for various use cases, you can effectively manage state and encapsulate business logic in your Flutter applications.
📜 License #
MIT License
Happy coding! 🚀