StreamController(
{void onListen(),
void onPause(),
void onResume(),
dynamic onCancel(),
bool sync: false}
)

A controller with a stream that supports only one single subscriber.

If sync is true, the returned stream controller is a SynchronousStreamController, and must be used with the care and attention necessary to not break the Stream contract.

The controller will buffer all incoming events until the subscriber is registered.

The onPause function is called when the stream becomes paused. onResume is called when the stream resumed.

The onListen callback is called when the stream receives its listener and onCancel when the listener ends its subscription. If onCancel needs to perform an asynchronous operation, onCancel should return a future that completes when the cancel operation is done.

If the stream is canceled before the controller needs new data the onResume call might not be executed.