eventsubscriber 1.0.1 copy "eventsubscriber: ^1.0.1" to clipboard
eventsubscriber: ^1.0.1 copied to clipboard

outdated

A Flutter widget that supports subscribing to one or more named EventNotifier events.

EventSubscriber #

Pub Package

A Flutter widget that supports subscribing to one or more named EventNotifier events.

The EventSubscriber widget will be notified and rebuilt when a subscribed event occurs, allowing some changing aspect of a problem domain model to be displayed in your Flutter user interface.

See also #

EventNotifier - broadcasts named events to interested subscribers.

Dependencies #

  • Flutter - This Dart package has a dependency on the Flutter framework.

Usage #

A simple example:

import 'package:flutter/material.dart';
import 'package:eventnotifier/eventnotifier.dart';
import 'package:eventsubscriber/eventsubscriber.dart';

// An example domain model
// Normally in its own module/package
// Included here for illustration purposes
class Count with EventNotifier {
  int value = 0;
  void increment() {
    value++;
    notify('valueChanged'); // notify subscribers
  }
}

//////////////////////

// Create the domain model
var myCount = Count();

// Flutter application
void main() => runApp(
    MaterialApp(
        home: Column(
            children: <Widget>[
            // Subscribe to the 'valueChanged' model event
            EventSubscriber(      // <<===
                model: myCount,
                eventNames: ['valueChanged'],
                builder: (context) => Text(myCount.value.toString()),
            ),
            FlatButton(
                child: Text('Increment'),
                onPressed: () => myCount.increment(),
            )
            ],
        ),
    ),
);

Features and bugs #

Please file feature requests and bugs at the issue tracker.

5
likes
0
pub points
73%
popularity

Publisher

verified publisheraryehoffman.com

A Flutter widget that supports subscribing to one or more named EventNotifier events.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

eventnotifier, flutter

More

Packages that depend on eventsubscriber