minibus 0.0.4

  • Example
  • Installing
  • Versions
  • 83


A library for a minimal synchronous event bus.

Basic Usage

A simple usage example:

import 'package:minibus/minibus.dart';
String EVENT = "myevent";

main() {
  MiniBus bus1 = new MiniBus();
  bus1.subscribe(EVENT, (){print('Hello World!')});;

Features and bugs

Please file feature requests and bugs.

Run tests with:

  • pub run test

Check source code formatting:

  • dartfmt -n .



  • Minor refactoring and SDK constraint changed.


  • Update to prepare for Dart 2.0.
  • Documentation updated - details and example.


  • Added (optionally) events with data providers.


  • Initial version.


// Copyright (c) 2017, daftspaniel. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.

import 'package:minibus/minibus.dart';

const String EVENT = "Greeting";
const String ANOTHER_EVENT = "Goodbye";

void hello() {

void hi() {

void bye() {

main() {
  print('\n * Event with single listener.\n');
  MiniBus bus1 = new MiniBus();
  bus1.subscribe(EVENT, hi);;

  print('\n * Event with multiple listeners.\n');
  MiniBus bus2 = new MiniBus();
  bus2.subscribe(EVENT, hi);
  bus2.subscribe(EVENT, hello);
  bus2.subscribe(ANOTHER_EVENT, bye);;

  print('\n * See what is connected:\n');;;

  print('\n * Get some data with and event:\n');
  MiniBus bus3 = new MiniBus();
  int eventValue;
  int provider() {
    return 1234;

  void handler(Function dataProvider) {
    eventValue = dataProvider();

  bus3.subscribe("Test", handler);"Test", provider);
  print('   event returned ${eventValue}');;

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  minibus: "^0.0.4"

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

      import 'package:minibus/minibus.dart';
Version Uploaded Documentation Archive
0.0.4 Sep 28, 2017 Go to the documentation of minibus 0.0.4 Download minibus 0.0.4 archive
0.0.3 Jul 16, 2017 Go to the documentation of minibus 0.0.3 Download minibus 0.0.3 archive
0.0.2 Jun 28, 2017 Go to the documentation of minibus 0.0.2 Download minibus 0.0.2 archive
0.0.1 Jun 24, 2017 Go to the documentation of minibus 0.0.1 Download minibus 0.0.1 archive


We analyzed this package on Jun 19, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.63.0
  • pana: 0.11.3


Describes how popular the package is relative to other packages. [more]
65 / 100
Code health derived from static analysis. [more]
100 / 100
Reflects how tidy and up-to-date the package is. [more]
100 / 100
Overall score:
Weighted score of the above. [more]
Learn more about scoring.


Detected platforms: Flutter, web, other

No platform restriction found in primary library package:minibus/minibus.dart.


  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.20.1 <2.0.0
Dev dependencies
test ^0.12.0