streamable 0.4.1

  • README.md
  • Installing
  • Versions
  • 24

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

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages 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...

Analysis

We analyzed this package on May 22, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.54.0
  • pana: 0.11.1

Scores

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

Platforms

Detected platforms: Flutter, web, other

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

Suggestions

  • 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.

  • Use constrained dependencies.

    The pubspec.yaml contains 2 dependencies without version constraints. Specify version ranges for the following dependencies: ds, hub.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 1 error 3 hints.

    Strong-mode analysis of lib/streamable.dart failed with the following error:

    line: 246 col: 38
    The getter 'willEndOnDrain' isn't defined for the class 'Streamable<T>'.

  • 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.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • 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.

Dependencies

Package Constraint Resolved Available
Direct dependencies
ds any 0.4.3
hub any 0.12.1
Transitive dependencies
browser 0.10.0+3