Skip to content

Commit

Permalink
fix(example): do not listen lifecycle when controller has not been in…
Browse files Browse the repository at this point in the history
…itialized
  • Loading branch information
ThibaultBee committed Feb 12, 2024
1 parent 0417737 commit 4c44c70
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ class _LiveViewPageState extends State<LiveViewPage>

@override
void didChangeAppLifecycleState(AppLifecycleState state) {
// App state changed before we got the chance to initialize.
if (!_controller.isInitialized) {
return;
}

if (state == AppLifecycleState.inactive) {
_controller.stop();
} else if (state == AppLifecycleState.resumed) {
Expand Down

0 comments on commit 4c44c70

Please sign in to comment.