Skip to content
pubscout

flutter_observer

2.0.0, released 5 years ago by an unverified publisher

Android BroadcastReceiver and iOS NSNotification pattern for Flutter.

WASM-ready
$ flutter pub add flutter_observer
Source repository

What it does

Provides a global observer pattern similar to Android BroadcastReceiver and iOS NSNotification to notify pages to refresh. It allows registering and removing observers and sending notifications with optional names and maps across pages.

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

Use it when

  • You want to broadcast simple notifications between pages without passing complex callback functions.
  • You need a lightweight publish-subscribe notification mechanism similar to native mobile broadcast systems.

Skip it when

  • You need robust, predictable state management with strict architectural boundaries like BLoC or Riverpod.
  • You prefer reactive, stream-based data flows for managing complex app state.

Strengths

  • Simple API with minimal boilerplate
  • Pure Dart development package
  • Supports targeted notifications using state names and notify names

Weaknesses

  • Relies on global singleton state which can make testing difficult
  • Lacks type-safe payloads since data is passed via generic Maps
  • Documentation is sparse and partly in Chinese

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
0

Not documented

class APageState extends State<APage> with Observer {
  @override
  void initState() {
    Observable.instance.addObserver(this);
    super.initState();
  }
  @override
  void dispose() {
    Observable.instance.removeObserver(this);
    super.dispose();
  }
  @override
  update(Observable observable, String notifyName, Map map) {
    setState(() {});
  }
}

Alternatives

Packages that do the same job and could replace flutter_observer.

  • provider

    Provides a more robust and idiomatic way to manage and listen to state changes in Flutter apps.

  • riverpod

    Offers a compile-safe, modern alternative for dependency injection and state observation.