diff --git a/lib/screens/home/local_widgets/expenses_chart.dart b/lib/screens/home/local_widgets/expenses_chart.dart index 4cef78e..4b89f69 100644 --- a/lib/screens/home/local_widgets/expenses_chart.dart +++ b/lib/screens/home/local_widgets/expenses_chart.dart @@ -12,6 +12,14 @@ class ExpensesChart extends StatefulWidget { class ExpensesChartState extends State { int? touchedIndex; + bool disposed = false; + + @override + void dispose() { + disposed = true; + super.dispose(); + } + @override Widget build(BuildContext context) { List categories = @@ -24,6 +32,7 @@ class ExpensesChartState extends State { pieTouchData: PieTouchData(touchCallback: (event, pieTouchResponse) { if (pieTouchResponse == null) return; + if (disposed) return; setState(() { if (event is FlLongPressEnd || event is FlPanEndEvent) {