Simplify assertion in AsyncSnapshot (#135899)

Simplify assertion in `AsyncSnapshot`.

Fixes #135731.
This commit is contained in:
Mateus Felipe C. C. Pinto 2023-10-06 21:58:05 -03:00 committed by GitHub
parent 90ea6eef7e
commit dcd24ef0fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -200,7 +200,7 @@ class AsyncSnapshot<T> {
/// and optionally either [data] or [error] with an optional [stackTrace]
/// (but not both data and error).
const AsyncSnapshot._(this.connectionState, this.data, this.error, this.stackTrace)
: assert(!(data != null && error != null)),
: assert(data == null || error == null),
assert(stackTrace == null || error != null);
/// Creates an [AsyncSnapshot] in [ConnectionState.none] with null data and error.