Magator Logo


A Object broker for flutter app
Send messages to any widget from anywhere in your flutter app

Broker is a package for Flutter apps that functions as a message broker, allowing you to send messages from anywhere in your app to any widget. With Broker, you only need to initialize the Broker class once, and you can use it anywhere in your app to send messages to widgets both above and below. Additionally, if you have multiple subscribers, Broker supports message broadcasting, making it easy to ensure that all relevant widgets receive the same message


  • A message broker for flutter app
  • Send messages to any widget irrespective of there position in widget tree.
  • Support message brodcasting.
  • Initialize once and use anywhere, use function getBroker().

Getting started

import 'package:broker/broker.dart';


Step 1

void main() {
    // initializing Broker once and use it anywhere
    Broker broker = Broker();

    runApp(const MyApp());

Step 2

// I will suggest to put this line in your stateless or statefull class as attribute
late Broker broker;

// I will suggest to put this code in initState() function
broker = getBroker();

broker.listen("<subscriber-name>", (event) {
    Protocol protocol = (event as Protocol);
    print("Message: ${}");

If your are having problem setting up, see exampe