Remove mentions of `NullThrownError` from documentation.
You can no longer pass `null` to, e.g., `StreamController.addError`,
so we shouldn't document what happens if you do.
In general, in sound null safe code, you cannot even attempt to throw `null`,
so the `NullThrownError` should go away when non-null-safe code stops being
supported.
Change-Id: I3dc7f5ac934b2af48095770767359e8720c3909a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179501
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
diff --git a/sdk/lib/async/stream_controller.dart b/sdk/lib/async/stream_controller.dart
index 981cfb2..cb305fe 100644
--- a/sdk/lib/async/stream_controller.dart
+++ b/sdk/lib/async/stream_controller.dart
@@ -198,8 +198,6 @@
/// Sends or enqueues an error event.
///
- /// If [error] is `null`, it is replaced by a [NullThrownError].
- ///
/// Listeners receive this event at a later microtask. This behavior can be
/// overridden by using `sync` controllers. Note, however, that sync
/// controllers have to satisfy the preconditions mentioned in the
diff --git a/sdk/lib/core/errors.dart b/sdk/lib/core/errors.dart
index 7ef44c0..f0d6178 100644
--- a/sdk/lib/core/errors.dart
+++ b/sdk/lib/core/errors.dart
@@ -118,6 +118,9 @@
class CastError extends Error {}
/// Error thrown when attempting to throw `null`.
+///
+/// In null safe code, you are statically disallowed from throwing `null`,
+/// so this error will go away when non-null safe code stops being supported.
class NullThrownError extends Error {
@pragma("vm:entry-point")
NullThrownError();