8000 Use proper state lifecycle method for nulling renderer state changed … · hicodeboy/flutter-webrtc@675a37b · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit 675a37b

Browse files
committed
Use proper state lifecycle method for nulling renderer state changed handler
Currently used `deactivate` method can be called many times during a state lifecycle. (For example, it called several times during animation, which occurs when Scaffold with RTCVideoView is shown with regular route push animation.) Actually, subclasses should override `deactivate` method to clean up any links between this object and other elements in the tree (e.g. if you have provided an ancestor with a pointer to a descendant's RenderObject).
1 parent 0051af3 commit 675a37b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/rtc_video_view.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ class _RTCVideoViewState extends State<RTCVideoView> {
128128
}
129129

130130
@override
131-
void deactivate() {
132-
super.deactivate();
131+
void dispose() {
132+
super.dispose();
133133
widget._renderer.onStateChanged = null;
134134
}
135135

lib/web/rtc_video_view.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,8 @@ class _RTCVideoViewState extends State<RTCVideoView> {
171171
}
172172

173173
@override
174-
void deactivate() {
175-
super.deactivate();
174+
void dispose() {
175+
super.dispose();
176176
_renderer.onStateChanged = null;
177177
}
178178

0 commit comments

Comments
 (0)
0