Search packages, repositories and app categories

GitHub repositoryfelangel/broadcast_bloc

broadcast_bloc

An extension to the bloc state management library which adds support for broadcasting state changes to stream channels.

broadcast_bloc project cover
Stars
26
Forks
0
Last push (UTC)
Apr 13, 2026
Project status
Active

Original README

English project snapshot. Visit GitHub for the latest content.

Broadcast Bloc

build coverage pub package style: bloc lint License: MIT

An extension to the bloc state management library which adds support for broadcasting state changes to stream channels.

Learn more at bloclibrary.dev!


Sponsors

Our top sponsors are shown below! [Become a Sponsor]


Quick Start 🚀

// Extend `BroadcastCubit` instead of `Cubit`.
// The package also exports:
// * `BroadcastBloc`
// * `BroadcastMixin`
class CounterCubit extends BroadcastCubit<int> {
  CounterCubit() : super(0);

  void increment() => emit(state + 1);
}

void main() {
  final controller = StreamController<String>(sync: true);
  final subscription = controller.stream.listen(print);
  final channel = StreamChannel(controller.stream, controller.sink);

  // Create an instance of the cubit.
  final cubit = CounterCubit()
    // Subscribe the channel.
    ..subscribe(channel)
    // Trigger a state change which will be broadcast to subscribed channels.
    ..increment()
    // Unsubscribe channel.
    ..unsubscribe(channel);

  subscription.cancel();
  cubit.close();
}
Felix Angelov GitHub avatar
GitHub author

Felix Angelov ↗

software engineer by day, software engineer by night.

LanguagesDart

Packages published by this repository

Dependencies used

Dependency list 5 items

How do I choose a repository?

Start with your use case, compare repository activity, and check the original project before adopting it.

  1. Search by repository name, owner or description, then narrow the results by topic.
  2. Compare stars, forks and recent pushes. Stars show community interest, not a guarantee of quality.
  3. Read the README, license and issues on GitHub before using a project.

Sources and maintenance

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗