Movatterモバイル変換


[0]ホーム

URL:


menu
  1. Dart
  2. dart:async
  3. Stream<T>
  4. length property
length
description

length property

Future<int> getlength

The number of elements in this stream.

Waits for all elements of this stream. When this stream ends,the returned future is completed with the number of elements.

If this stream emits an error,the returned future is completed with that error,and processing stops.

This operation listens to this stream, and a non-broadcast stream cannotbe reused after finding its length.

Implementation

Future<int> get length {  _Future<int> future = _Future<int>();  int count = 0;  this.listen(    (_) {      count++;    },    onError: future._completeError,    onDone: () {      future._complete(count);    },    cancelOnError: true,  );  return future;}
  1. Dart
  2. dart:async
  3. Stream<T>
  4. length property
Stream class

[8]ページ先頭

©2009-2025 Movatter.jp