neurone 1.0.0

  • Readme
  • Changelog
  • Example
  • Installing
  • new50

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

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter 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]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
50
Learn more about scoring.

We analyzed this package on Oct 9, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:neurone/neurone.dart.

Health suggestions

Fix lib/neurone.dart. (-0.50 points)

Analysis of lib/neurone.dart reported 1 hint:

line 54 col 28: Don't explicitly initialize variables to null.

Dependencies

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