From 2aa4435f733627a2027cd32784226e6c68395e8c Mon Sep 17 00:00:00 2001 From: Aditya Chavda <98031138+aditya-css@users.noreply.github.com> Date: Fri, 23 Feb 2024 21:31:50 +0530 Subject: [PATCH] :bug: Safe guard adding new Floating events (#161) - Fixes [#157](https://github.com/SimformSolutionsPvtLtd/flutter_credit_card/issues/157) --- CHANGELOG.md | 4 ++++ lib/src/credit_card_widget.dart | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b020300..022fefc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# [4.0.2](https://github.com/SimformSolutionsPvtLtd/flutter_credit_card/tree/4.0.2) [UNRELEASED] + +- Fixed floating event stream bad state exception [#157](https://github.com/SimformSolutionsPvtLtd/flutter_credit_card/issues/157). + # [4.0.1](https://github.com/SimformSolutionsPvtLtd/flutter_credit_card/tree/4.0.1) - Fixed glare effect issue [#154](https://github.com/SimformSolutionsPvtLtd/flutter_credit_card/pull/154). diff --git a/lib/src/credit_card_widget.dart b/lib/src/credit_card_widget.dart index 8b55432..f5083c1 100644 --- a/lib/src/credit_card_widget.dart +++ b/lib/src/credit_card_widget.dart @@ -359,7 +359,7 @@ class _CreditCardWidgetState extends State } void _processFloatingEvent(FloatingEvent? event) { - if (event == null || controller.isAnimating) { + if (!mounted || event == null || controller.isAnimating) { return; }