join method

Future<String> join ([String separator = "" ])

Combines the string representation of elements into a single string.

Each element is converted to a string using its Object.toString method. If separator is provided, it is inserted between element string representations.

The returned future is completed with the combined string when the stream is done.

If the stream contains an error, or if the call to Object.toString throws, the returned future is completed with that error, and processing stops.


Future<String> join([String separator = ""]) {
  _Future<String> result = new _Future<String>();
  StringBuffer buffer = new StringBuffer();
  StreamSubscription subscription;
  bool first = true;
  subscription = this.listen((T element) {
    if (!first) {
    first = false;
    try {
    } catch (e, s) {
      _cancelAndErrorWithReplacement(subscription, result, e, s);
  }, onError: (e) {
  }, onDone: () {
  }, cancelOnError: true);
  return result;