From 49fa2e1e64f7b2cac956e168e33ff8312792fcfd Mon Sep 17 00:00:00 2001 From: Aditya Chavda <98031138+aditya-css@users.noreply.github.com> Date: Mon, 29 Apr 2024 12:24:45 +0530 Subject: [PATCH] fix: :bug: Fixed RecalculateRootWidgetSize null check issue. (#429) - Added `mounted` check in `addPostFrameCallback` under `recalculateRootWidgetSize` in `showcase.dart` as to ensure that the operation is only performed if the element is mounted. --- CHANGELOG.md | 1 + lib/src/showcase.dart | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 28c0013c..51fd8dd6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## [2.1.1] - Fixed [#425](https://github.com/SimformSolutionsPvtLtd/flutter_showcaseview/issues/425) - Unhandled breaking change in v2.1.0 +- Fixed [#428](https://github.com/SimformSolutionsPvtLtd/flutter_showcaseview/issues/428) - _ShowcaseState.recalculateRootWidgetSize null value ## [2.1.0] - Feature [#420](https://github.com/SimformSolutionsPvtLtd/flutter_showcaseview/pull/420) - Dart SDK Upgrade diff --git a/lib/src/showcase.dart b/lib/src/showcase.dart index ee53916a..598a11cd 100644 --- a/lib/src/showcase.dart +++ b/lib/src/showcase.dart @@ -472,6 +472,7 @@ class _ShowcaseState extends State { void recalculateRootWidgetSize() { ambiguate(WidgetsBinding.instance)?.addPostFrameCallback((_) { + if (!mounted) return; final rootWidget = context.findRootAncestorStateOfType>(); rootRenderObject = rootWidget?.context.findRenderObject() as RenderBox?;