api_bloc library

A Flutter library for managing API calls using the BLoC pattern. This library provides a set of classes and utilities to simplify API calls and manage state changes.

Classes

ApiBloc<T extends BlocStates<Object?>>
Main widget on dealing BlocStates changes in controller.
BlocController<T extends BlocStates<Object?>>
Ancestor class of controller used in this package.
BlocStates<T extends Object?>
Ancestor class of every state used in ApiBloc.
GetController
An extended abstract class of BlocController specifically made for fetching api request.
GetErrorState<T extends Object?>
Represents the error state when an error occurs during data fetching in GetController.
GetLoadingState<T extends Object?>
Represents the loading state when data is being fetched in GetController.
GetStates<T extends Object?>
The base state class used in GetController.
GetSuccessState<T extends Object>
Represents the success state when data fetching is successful in GetController.
SendController
An extended abstract class of BlocController specifically made for submitting api request.
SendErrorState<T extends Object?>
Represents the error state when an error occurs during request submission in SendController.
SendFailedState<T extends Object>
Represents the failed state when a request submission fails in SendController.
SendIdleState<T extends Object?>
Represents the idle state when no request is in progress in SendController.
SendLoadingState<T extends Object?>
Represents the loading state when a request is in progress in SendController.
SendStates<T extends Object?>
The base state class used in SendController.
SendSuccessState<T extends Object>
Represents the success state when a request is successfully submitted in SendController.

Enums

GetStateType
On fetching request, there is usually consist of three states.
SendStateType
The different types of states that can be represented in SendController.

Typedefs

BlocBuilder<T extends BlocStates<Object?>> = Widget Function(BuildContext context, T state, Widget child)
Signature for a function that builds a widget tree based on the current BlocStates.
BlocListener<T extends BlocStates<Object?>> = void Function(BuildContext context, T state)
Signature for a function that listens to changes in the BlocStates.
OnBlocBuilder<S extends Object?> = Widget Function(BuildContext context, BlocStates<S> state, Widget child)
Signature for a function that builds a widget tree based on the current BlocStates.
OnBlocListener<S extends Object?> = void Function(BuildContext context, BlocStates<S> state)
Signature for a function that listens to changes in the BlocStates.