Skip to content

Commit

Permalink
fix for #469 crashing on tab change
Browse files Browse the repository at this point in the history
  • Loading branch information
dreautall committed Oct 26, 2024
1 parent e13b093 commit ff61cb4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/pages/home/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import 'package:waterflyiii/pages/home/main_charts/lastdays.dart';
import 'package:waterflyiii/pages/home/main_charts/netearnings.dart';
import 'package:waterflyiii/pages/home/main_charts/networth.dart';
import 'package:waterflyiii/pages/home/main_charts/summary.dart';
import 'package:waterflyiii/stock.dart';
import 'package:waterflyiii/timezonehandler.dart';
import 'package:waterflyiii/widgets/charts.dart';

Expand Down Expand Up @@ -53,17 +54,19 @@ class _HomeMainState extends State<HomeMain>
List<ChartDataSet> overviewChartData = <ChartDataSet>[];
final List<InsightGroupEntry> catChartData = <InsightGroupEntry>[];
final Map<String, Budget> budgetInfos = <String, Budget>{};
late TransStock _stock;

@override
void initState() {
super.initState();

context.read<FireflyService>().transStock!.addListener(_refreshStats);
_stock = context.read<FireflyService>().transStock!;
_stock.addListener(_refreshStats);
}

@override
void dispose() {
context.read<FireflyService>().transStock!.removeListener(_refreshStats);
_stock.removeListener(_refreshStats);

super.dispose();
}
Expand Down

0 comments on commit ff61cb4

Please sign in to comment.