Skip to content

Commit

Permalink
removeListener in unit (apache#23593)
Browse files Browse the repository at this point in the history
  • Loading branch information
darkhan.nausharipov committed Oct 21, 2022
1 parent d9acc0f commit 8035775
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions learning/tour-of-beam/frontend/lib/pages/tour/widgets/unit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,17 @@ class _UnitWidgetState extends State<UnitWidget> {
@override
void initState() {
super.initState();
widget.contentTreeController.addListener(() {
setState(() {});
});
widget.contentTreeController.addListener(_rebuild);
}

@override
void dispose() {
widget.contentTreeController.removeListener(_rebuild);
super.dispose();
}

void _rebuild() {
setState(() {});
}

@override
Expand Down

0 comments on commit 8035775

Please sign in to comment.