From e70d4a1c1b7d425b64a8dbf4efceae0cccc50897 Mon Sep 17 00:00:00 2001 From: Kenzie Davisson <43759233+kenzieschmoll@users.noreply.github.com> Date: Mon, 25 Sep 2023 10:57:44 -0700 Subject: [PATCH] Add description to assert in `history.dart` (flutter/engine#46072) I have hit this assertion error many times in tests and this message would be helpful for debugging. --------- Co-authored-by: Mouad Debbar --- .../lib/web_ui/lib/src/engine/navigation/history.dart | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/engine/src/flutter/lib/web_ui/lib/src/engine/navigation/history.dart b/engine/src/flutter/lib/web_ui/lib/src/engine/navigation/history.dart index dce3ba4213..ef90ad9c9f 100644 --- a/engine/src/flutter/lib/web_ui/lib/src/engine/navigation/history.dart +++ b/engine/src/flutter/lib/web_ui/lib/src/engine/navigation/history.dart @@ -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);