Skip to content

Commit

Permalink
Simplify assertion in AsyncSnapshot (flutter#135899)
Browse files Browse the repository at this point in the history
Simplify assertion in `AsyncSnapshot`.

Fixes flutter#135731.
  • Loading branch information
mateusfccp authored Oct 7, 2023
1 parent 90ea6ee commit dcd24ef
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/widgets/async.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit dcd24ef

Please sign in to comment.