Movatterモバイル変換


[0]ホーム

URL:


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

last property

Future<T> getlast

The last element of this stream.

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

If this stream is empty (the done event is the first event),the returned future completes with an error.

Implementation

Future<T> get last {  _Future<T> future = _Future<T>();  late T result;  bool foundResult = false;  listen(    (T value) {      foundResult = true;      result = value;    },    onError: future._completeError,    onDone: () {      if (foundResult) {        future._complete(result);        return;      }      var stack = StackTrace.empty;      var error = IterableElementError.noElement();      _trySetStackTrace(error, stack);      _completeWithErrorCallback(future, error, stack);    },    cancelOnError: true,  );  return future;}
  1. Dart
  2. dart:async
  3. Stream<T>
  4. last property
Stream class

[8]ページ先頭

©2009-2025 Movatter.jp