blob: 14394c95ef8170730571bb620fdc8c3aa6226517 [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 Future<T> first
/// Stops listening to the stream after the first element has been received.
/// Internally the method cancels its subscription after the first element.
/// This means that single-subscription (non-broadcast) streams are closed and
/// cannot be reused after a call to this getter.
/// @description Checks that non broadcast stream can not be listened after
/// the first element is returned.
/// @author
library first_A04_t01;
import "dart:async";
import "../../../Utils/expect.dart";
void check(Stream s) {
(_) {
if (!s.isBroadcast){
Expect.throws(() => s.listen((_){}));
void test(CreateStreamFunction create) {