I have a stream of data and I want to add new value to an existing stream. Code looks like this
Stream<List<Points>> _points;
_points.sink.add(values);
is this possible, or do I have to find a different way?
You can send data to a stream using the sink in a StreamController as well as add existing streams to the controller
// Create controller
final streamController = StreamController<List<Point>>();
// Listen to stream
streamController.stream.listen((points) { doStuff(points); });
// Send data to stream
streamController.sink.add([const Point(0.0, 0.0), const Point(1.0, 1.0)]);
// You can also add other streams to the controller
streamController.addStream(otherStream);
StreamGroup()..add(_points)..add(anotherStream)StreamController-api.dart.dev/stable/2.14.3/dart-async/…