Bloc Storage

A lightweight package for storing and retrieving BLoC instances globally

  1. Easy storage of BLoC instances
  2. Easy retrieval of BLoC instances
  3. Clear specific or all stored BLoC instances

Basics

Syntax

To initiate a store , call the BlocStorage.store method, and pass the required bloc:

    BlocStorage.store<AuthBloc>(
      context.read<AuthBloc>()
    );

To retrieve a stored bloc, call the BlocStorage.retrieve method, and specify the required bloc

    BlocStorage.retrieve<AuthBloc>();

To clear a stored bloc, call the BlocStorage.clear method, and specify the required bloc

    BlocStorage.clear<AuthBloc>();

To clear all stored bloc, call the BlocStorage.clearAll method, and specify the required bloc

    BlocStorage.clearAll();

Installation

Grab it from pub.dev.

Libraries

bloc_storage
main