p-hatan/ mirror

pub repository

mirror.p-hatan.ir

observable

0.1.6

Easy registration and notification of events

This package is discontinued upstream.

Download archive

Readme

Synopsis

Observable provides a convenient mechanism of registering for events and dispatching notifications to listening clients.

How to use

Inheriting from Observable

The easiest way to use Observable is by inheriting from Observable, as given by:

import 'package:obvervable/obvervable.dart';

class Foo extends Observable

Clients register for notifications as illustrated in the following snippet:

Foo myFoo = new Foo();
myFoo.on.anEvent(() => print("AnEvent fired"));

Dispatching of events is done by invoking the dispatch method:

class Foo extends Observable
{
  .
  :
  .
  void method()
  {
    // carry out operations
    observer.dispatch("anEvent");
  }
}

Optionally, an argument can be passed in to dispatch:

observer.dispatch("anEvent", "anArg");

The above would cause "anArg" to be passed to be every event observer.

Composition

Since Dart does not support multiple inheritance, you may at times not be able to use the method outlined above. The alternative, then, is to use composition. Example:

import 'package:observable/observer.dart';
import 'package:observable/observer_events.dart';

class Foo extends SomeOtherClass
{
  Observer        observer;
  ObserverEvents  on;

  Foo()
    : observer = new Observer()
  {
    on = observer.on;
  }
}

Clients register for notifications and events are dispatched in the same manner as exemplified in the preceding section.

Changelog

Installing

export PUB_HOSTED_URL=https://pub.mirror.p-hatan.ir
flutter pub add observable
pubspec.yaml
name: observable
version: 0.1.6
author: Miguel Guedes <miguel.a.guedes@gmail.com>
description: Easy registration and notification of events
homepage: https://github.com/miguel-guedes/observable

Version history

VersionPublishedArchiveSHA-256
0.1.02014-06-06T16:41:32.001090ZDownloadd6fdf1e65de6103941a7377d4d268d4147c47850536b70850be8686a4bb8282f
0.1.12014-06-06T17:10:06.910100ZDownload8aa5feb72be0bfdb8d344ddd2da3dd13a2630da5e71dc40c8e30ba020fbeb59b
0.1.22014-06-06T18:12:36.721340ZDownload79d8074f5f771078c368508b836584dbce4a2d5b74cb80800d4cb03cc14950c2
0.1.32014-06-08T15:07:06.198290ZDownload142ddf0b61a4b653bda1a28a22ed2a57bfa21620f21daacee603a7087e875ba5
0.1.42014-06-08T15:08:37.263640ZDownloadac8da8a48ed40a2c169ed49135b277897a5c710f101bf88884f6477f0f144080
0.1.52014-06-11T12:09:08.919140ZDownloadaed2d42592befd39e1ca321631118d99538dff6bbfcc8fab70bcb3fac6df37d2
0.1.62014-06-11T13:46:07.823640ZDownload98674349a58d899c16c21927b0b625c7299e9b35872150a92f8727a74a0200c7
0.14.02016-09-23T20:48:35.289ZDownloadc5fc18c79e862c880c604568ac949e427d82214098f250d890ec824461940996
0.14.0+12016-09-26T17:05:37.029ZDownload549d63f721775224e229510760304766448b02c62c48f248192ea3a3c36aed9b
0.15.0+12016-11-17T01:37:36.985ZDownloadd8427a2b87da22a818d2b4e1b37c7f45775e26e0ccfbd63884c1d85a4a945111
0.16.02016-11-17T18:32:04.548ZDownloadb8abdac0b1ac8b296a961f6ae24247ec15a30755b734b68f67d1bf8394e87ff7
0.17.02016-11-17T23:17:29.180ZDownload01328f5b4c877837d64440daf0e8c343a122948689d195708953d4dad0cf013b
0.17.0+12016-11-21T18:59:50.788ZDownload8a6c6e21e1a5fc032fc49cfc28c5c3574962dbed3252d8570a5b1e4174c73025
0.18.02016-11-22T04:50:21.072ZDownloadbe648ac636727693806487e7e07a640665336fd2dff97582c5fcbd9e7ed70876
0.18.12016-11-22T20:16:21.692ZDownload44e76715dee5848404d4c1d6b0a39333f6f791d8c7c48e2bb4abc2204995dfbd
0.19.02016-11-23T01:31:07.467ZDownload371d4356dc92f71a004c71301fecb5237f43dff5e1f789ff79edc844078c0cde
0.20.12016-11-29T03:07:45.483ZDownloadba572ba1f5f11072e7109490ce416cb1338528c54a8561cadf154fe2d630397e
0.20.22016-12-20T07:22:32.443ZDownloadb9b4f7107089afb58f73346ddf9da4e64e56a02e62b729694c0129e484cc9d06
0.20.42017-02-25T04:21:45.913ZDownloadd6308bf35fc8803fed7e026fc991cf2ad4e02be63055a15eac9a2c51b3761d63
0.20.4+12017-04-04T20:02:29.019802ZDownload5382b3f529e69b44888baaa595eca60127290b4d26c223fd996a2d6561b71933
0.20.4+22017-12-27T18:49:28.130687ZDownload375870ad899a83138014f715c4031785445bcc0860b010ab08523e3ceb37b61e
0.20.4+32018-01-09T01:26:36.225295ZDownload898df861aa2c37614f81e00d5da4e6e50496a925f16a81a7e49b1ed5967df464
0.21.02018-02-12T18:09:51.151116ZDownloadebb9ff4bd8b957ef2bc102e1e604b04cab48b2ca9fcf5873854feae1c87d8a99
0.21.12018-03-01T02:04:09.492545ZDownload60c73ae870a0f001a23ce12678d815f3b932032763413d1bb15bd514af169301
0.21.22018-03-07T23:28:47.382783ZDownloadad3b0443325a0f10ca328555bd68d287f27d06d1a81b1abb065ccf413353957e
0.21.32018-03-13T16:59:28.153540ZDownloadf4e963b40cd0b460122a958ff77ccf97597a85e39cfab0b7303d9437a5c8f6b0
0.22.02018-03-19T17:07:57.288351ZDownloada7722c1d562039d433cb6b8cd257d6bc784d26ce044725409065d16136dc124a
0.22.12018-03-23T23:29:35.934828ZDownload2a88d6c6182bb1cc3d95841ff40a6f2bd54e527f76b21693d32680ea127f5f9f
0.22.1+12018-05-03T16:19:13.923304ZDownload631b89955023d9dd0a456cd21de780259bc759bbe98277fe7a1ebc6b6bb41e6f
0.22.1+22018-05-18T22:13:21.263251ZDownloadcb24c2888248a842710be263b9a981eba24563c6fd8351c08cc3b52b5ac765a7
0.22.1+32018-05-25T17:11:35.455328ZDownloaddda14d0c17ef7846f748aca2c8cdf388f326cc1b66bd963779d0f20cce267692
0.22.1+42018-07-23T18:41:54.734062ZDownloade45aeef60f47c2696b36718b383aad7cef9a7b252dcb6d16df6261906e96b957
0.22.1+52018-12-10T22:17:15.043501ZDownloada99d958c8483e369da3ab6832148364dc73fc22f6ee6c9792cbc8ecae7964e27
0.22.22019-02-05T22:26:59.772301ZDownloadbb74db48ca45dc26ae0e3f15334e2bd844ceacc23a31e9c18045df311833129f
0.23.02021-03-23T17:30:12.296140ZDownload72aeca9b76959826ca380bfe2517bc21a6a25d56f41ab620f1421728ffa5e564
0.24.02021-12-01T23:27:45.159724ZDownload6be2c1236cd4130a0e752895b0d3dee6d438d4c0b6775b8fe5808cf981aa9a70

Dependencies

No direct dependencies declared.