streamable 0.4.1

  • README.md
  • Installing
  • Versions
  • 0

Streamable

A simple,decent custom stream implementation,not to rival the inbuilt dart streams but to provide a special stream with a different approach,it basically was built to handle the streaming api for flow.dart(my flow based programming framework),but can be used for any project requiring push-down streams with basic pause-resume that flows both upward and downward to consumers.

###Candies:

#####Candy 1: Streamable Streamable is the standard streaming handler,you simple create one and send off your items,also a stream waits till it gets a function through its listen function,once it gets that,then it begins to propagate,it can be paused,resume, also allows attaching a function to it,to get notify everytime it drains all item in the stream using the ondrain function.

Streamable buffer = new Streamable();

buffer.transformer.on((n){
    return "$n little sheep";
});
buffer.whenInitd((n){
    print('emiting $n');
});

buffer.emit(1);
buffer.emit(3);
buffer.emit(2);

buffer.emit(5);
buffer.emitMass([6,7]);

buffer.on((n){
print("buffering: ${n}");
});

var subscriber = buffer.subscriber((m){ print('sub: $m'); });

#####Candy 2: Subscriber Subscriber is as simple as its sounds,its a hook into the stream that is passed to it which allows the pausing and resuming of its own unique stream without effecting the root stream its connected to,and allows the closing and ending of the subscription to the root stream

var sub = Subscriber.create(buffer);
sub.on((g){ print('subscribers item: $g'); });

buffer.pause();

buffer.emit(4);
buffer.resume();

//buffer.enablePushDelayed();

buffer.emit(8);

buffer.emit(9);
buffer.emit(10);
buffer.end();

buffer.emit(11);
buffer.emit(12);

#####Candy 2: MixedStreams MixedStreams provides a functional combination of a sets of streams,depending on a condition either by length or a custom condition function,it will gather all ejected events from the sets of streams and eject this sets depending on the condition into a new stream,a very useful technique for mixing a sets of streams into one as either individual packets or as a list of packets

Streamable buffer = Streamable.create();
Streamable stream = Streamable.create();  

var mixedOrder = (MixedStreams.combineOrder([buffer,stream])(null,null,(values,mixed,streams,injector){
     mixed.emitMass(values);
}));
 
var mixed = (MixedStreams.combineUnOrder([buffer,stream])((tg,cg){
   if(tg.length >= 2) return true;
   return false;
}));
   
buffer.emit(1);
stream.emit(4);
buffer.emit(3);
stream.emit(2);
 
mixed.pause();
mixed.on((t){
  print("mixed stream: $t");
});

mixedOrder.on((t){
  print("mixedOrder $t");  
});

mixed.resume();

Use this package as a library

1. Depend on it

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


dependencies:
  streamable: ^0.4.1

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:streamable/streamable.dart';
  
Version Uploaded Documentation Archive
0.4.1 Sep 25, 2014 Go to the documentation of streamable 0.4.1 Download streamable 0.4.1 archive
0.4.0 Sep 7, 2014 Go to the documentation of streamable 0.4.0 Download streamable 0.4.0 archive
0.3.9 Sep 7, 2014 Go to the documentation of streamable 0.3.9 Download streamable 0.3.9 archive
0.3.8 Sep 5, 2014 Go to the documentation of streamable 0.3.8 Download streamable 0.3.8 archive
0.3.7 Sep 4, 2014 Go to the documentation of streamable 0.3.7 Download streamable 0.3.7 archive
0.3.6 Sep 4, 2014 Go to the documentation of streamable 0.3.6 Download streamable 0.3.6 archive
0.3.5 Sep 4, 2014 Go to the documentation of streamable 0.3.5 Download streamable 0.3.5 archive
0.3.4 Sep 4, 2014 Go to the documentation of streamable 0.3.4 Download streamable 0.3.4 archive
0.3.3 Sep 4, 2014 Go to the documentation of streamable 0.3.3 Download streamable 0.3.3 archive
0.3.2 Sep 3, 2014 Go to the documentation of streamable 0.3.2 Download streamable 0.3.2 archive

All 30 versions...

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

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Issues and suggestions

Fix platform conflicts.

Error(s) prevent platform classification:

Fix dependencies in pubspec.yaml.

Fix dependencies in pubspec.yaml.

Running pub upgrade failed with the following output:

ERR: The current Dart SDK version is 2.0.0.
 
 Because streamable depends on ds any which requires SDK version <2.0.0, version solving failed.

Package is too old.

The package was released more than two years ago.

Maintain CHANGELOG.md.

Changelog entries help clients to follow the progress in your code.

Homepage does not exists.

We were unable to access http://influx.github.com/streamable.dart at the time of the analysis.

Add SDK constraint in pubspec.yaml.

For information about setting SDK constraint, please see https://www.dartlang.org/tools/pub/pubspec#sdk-constraints.

The description is too short.

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Maintain an example.

Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use streamable.dart.

Format lib/streamable.dart.

Run dartfmt to format lib/streamable.dart.