Skip to content
pubscout

event

3.1.0, released 2 years ago by aryehoffman.com

Create lightweight custom Dart Events and notify subscribers across modules.

$ flutter pub add event
Source repository

What it does

It provides a notification mechanism across independent packages, layers, or modules. Developers can declare custom Events, subscribe handler functions to them, and broadcast notifications with optional arguments.

AI-written summary of version 3.1.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need a simple event-driven notification pattern between independent layers or modules.
  • You want lightweight custom events inspired by C# events and delegates without heavy state management overhead.

Skip it when

  • You are already using a state management solution that natively handles cross-module communication and reactive updates.
  • You require complex event stream filtering and transformation natively without manually piping events to a StreamController.

Strengths

  • Zero non-development dependencies.
  • Lightweight with subscribers instantiated lazily only on first subscription.
  • Supports custom event arguments and includes helper classes like Value and Values.

Weaknesses

  • Lacks built-in advanced stream operators unless explicitly piped into a StreamController.
  • Requires manual unsubscription and memory management considerations.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0
import 'package:event/event.dart';

void main() {
  var e = Event();
  e.subscribe((args) => print("event occurred"));
  e.broadcast();
}

Alternatives

Packages that do the same job and could replace event.

Works with

Packages commonly used together with event: ones it builds on, ones built on it, and its own family.