Skip to content

Commit

Permalink
Add description to assert in history.dart (flutter#46072)
Browse files Browse the repository at this point in the history
I have hit this assertion error many times in tests and this message
would be helpful for debugging.

---------

Co-authored-by: Mouad Debbar <[email protected]>
  • Loading branch information
kenzieschmoll and mdebbar authored Sep 25, 2023
1 parent 0407495 commit bf709ab
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/web_ui/lib/src/engine/navigation/history.dart
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,12 @@ class MultiEntriesBrowserHistory extends BrowserHistory {
_isTornDown = true;

// Restores the html browser history.
assert(_hasSerialCount(currentState));
assert(
_hasSerialCount(currentState),
currentState == null
? 'unexpected null history state'
: "history state is missing field 'serialCount'",
);
final int backCount = _currentSerialCount;
if (backCount > 0) {
await urlStrategy!.go(-backCount);
Expand Down

0 comments on commit bf709ab

Please sign in to comment.