Remove reference to nullable StackTrace from Stream.listen docs.
The StackTrace argument will never be null, but may be a default.
Also rewrite the type descriptions to use function type syntax instead
of the legacy argument syntax, and remove a redundant parameter name.
Bug: #43655
Change-Id: Ie91024b2a70d66c24ce29e413c811a61beae3bfc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166460
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
diff --git a/sdk/lib/async/stream.dart b/sdk/lib/async/stream.dart
index 8d2a625aa..150a759 100644
--- a/sdk/lib/async/stream.dart
+++ b/sdk/lib/async/stream.dart
@@ -483,11 +483,13 @@
* On errors from this stream, the [onError] handler is called with the
* error object and possibly a stack trace.
*
- * The [onError] callback must be of type `void onError(Object error)` or
- * `void onError(Object error, StackTrace stackTrace)`. If [onError] accepts
- * two arguments it is called with the error object and the stack trace
- * (which could be `null` if this stream itself received an error without
- * stack trace).
+ * The [onError] callback must be of type `void Function(Object error)` or
+ * `void Function(Object error, StackTrace)`.
+ * The function type determines whether [onError] is invoked with a stack
+ * trace argument.
+ * The stack trace argument may be [StackTrace.empty] if this stream received
+ * an error without a stack trace.
+ *
* Otherwise it is called with just the error object.
* If [onError] is omitted, any errors on this stream are considered unhandled,
* and will be passed to the current [Zone]'s error handler.