Skip to content

Commit

Permalink
fix: 🐛 Added mounted check before setState in `_reverseAnimateToolt…
Browse files Browse the repository at this point in the history
…ip` (#411)

- Added mounted check before `setState` in `_reverseAnimateTooltip` as this maybe called when widget is unmounted as this may be called when user taps very quickly and widget gets unmounted which throws error
  • Loading branch information
Sahil-Simform authored Mar 8, 2024
1 parent 189a760 commit 42daa48
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/src/showcase.dart
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,7 @@ class _ShowcaseState extends State<Showcase> {
/// Reverse animates the provided tooltip or
/// the custom container widget.
Future<void> _reverseAnimateTooltip() async {
if (!mounted) return;
setState(() => _isTooltipDismissed = true);
await Future<dynamic>.delayed(widget.scaleAnimationDuration);
_isTooltipDismissed = false;
Expand Down

0 comments on commit 42daa48

Please sign in to comment.