blob: bfedd63d88aa5f63813e879e41899b0a6b687c18 [file] [log] [blame]
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
/// @assertion Stream<T> stream
/// The stream that this controller is controlling.
/// @description Checks Stream interface implementation
/// @author
import "dart:async";
import "../Stream/allTests_A02.lib.dart";
Stream<T> create<T>(Iterable<T> data, {bool isError(T element)?, T? defVal}) {
StreamController<T> sc = new StreamController<T>();
for (T e in data) {
if (isError != null && isError(e)) {
sc.addError(e as Object);
} else {
new Future(() => sc.close()); // close stream controller later
main() {