presentStreamExmpl method

void presentStreamExmpl()

another basic stream example

Implementation

void presentStreamExmpl() {
  var data = intList;
  Stream stream = Stream.fromIterable(data);
  Stream broadcastStream = stream.asBroadcastStream();

  broadcastStream //   using   method   cascades...
    // TODO  Test:  can we NOT use shorthand function?
    ..listen((value) => print("SUCCESS_1_:: stream.listen: $value"))
    ..first.then((value) => print("SUCCESS_2_:: stream.first: $value")) // 1
    ..last.then((value) => print("SUCCESS_3_:: stream.last: $value")) // 5
    ..isEmpty.then(
        (value) => print("SUCCESS_4_:: stream.isEmpty: $value")) // false
    ..length
        .then((value) => print("SUCCESS_5_:: stream.length: $value")); // 5
}