neurone 1.0.0 copy "neurone: ^1.0.0" to clipboard
neurone: ^1.0.0 copied to clipboard

discontinued

An extremely small library for emitting local events in dart

Neurone #

An extremely small library for emitting local events in dart , built with streams . It's mirrorless , so you can also use it to trigger custom events in flutter . You can also pass data with neurone . But neurone is extremely basic and small . It can only emit , listen and kill a stream . If you are looking for something more advanced , neurone is not for you .

Example #

import 'package:neurone/neurone.dart';
import 'dart:async';

main() async {
  Neurone neurone = Neurone();
  neurone.listen("event1", (a) {
    print(a); // returns "valueXYZ"
  });
  neurone.listen("event2", (a) {
    print(a); // won't execute as "event2" was never triggered
  });
  await Future.delayed(Duration(seconds: 2)).then((v) {
    neurone.emit("event1", "valueXYZ");
  });
}

It's that simple to fire and react to an event ! . You can also create multiple event buses .

Multiple #

import 'package:neurone/neurone.dart';
import 'dart:async';

main() async {
  Neurone neuroneX = Neurone();
  Neurone neuroneY = Neurone();
}

Synchronus neurone #

It's false by default however you can create synchronus neurones like this .

Neurone neuroneX = Neurone(synchronize: true);

Created and maintained by Adib Mohsin

0
likes
40
pub points
0%
popularity

Publisher

unverified uploader

An extremely small library for emitting local events in dart

Repository (GitHub)
View/report issues

License

BSD-2-Clause (LICENSE)

More

Packages that depend on neurone