neurone 1.0.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 0

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

1.0.0 #

  • Support for dart 2.*
  • Added single bus event emitting / listening support

example/example.dart

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

main() async {
  Neurone neurone = Neurone(synchronize: false);
  neurone.listen("event1", (a) {
    print(a);
  });
  neurone.listen("event2", (a) {
    print(a);
  });
  await Future.delayed(Duration(seconds: 2)).then((v) {
    neurone.emit("event1", "valueXYZ");
  });
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  neurone: ^1.0.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:neurone/neurone.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
--
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
--
Overall:
Weighted score of the above. [more]
0
Learn more about scoring.

This package is not analyzed, because it is discontinued.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.36.0 <3.0.0