Skip to content

Commit

Permalink
Making it so that we properly forget the Visbility Detector's Timer w…
Browse files Browse the repository at this point in the history
…hen disposing BetterPlayer (jhomlala#452)
  • Loading branch information
ChopinDavid authored May 8, 2021
1 parent 8954f8f commit 0eca0f9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/src/core/better_player.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@ import 'package:better_player/better_player.dart';
import 'package:better_player/src/configuration/better_player_controller_event.dart';
import 'package:better_player/src/core/better_player_utils.dart';
import 'package:better_player/src/core/better_player_with_controls.dart';

// Flutter imports:
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';

// Package imports:
import 'package:visibility_detector/visibility_detector.dart';
import 'package:wakelock/wakelock.dart';
Expand Down Expand Up @@ -123,6 +121,8 @@ class _BetterPlayerState extends State<BetterPlayer>
WidgetsBinding.instance!.removeObserver(this);
_controllerEventSubscription?.cancel();
widget.controller.dispose();
VisibilityDetectorController.instance
.forget(Key("${widget.controller.hashCode}_key"));
super.dispose();
}

Expand Down

0 comments on commit 0eca0f9

Please sign in to comment.