Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A ValueNotifier<bool> was used after being disposed & A TikTokVideoListController was used after being disposed. #43

Closed
gautamenbake opened this issue Mar 2, 2022 · 3 comments

Comments

@gautamenbake
Copy link

gautamenbake commented Mar 2, 2022

Actually, I'm showing continuous video player [similar to homePage] on upper layer (means in separate screen).

I had opened videoplayer and close it, at the dispose time it shows these errors

I'm doing this in dispose method

 @override
  void dispose() {
    WidgetsBinding.instance!.removeObserver(this);
    _videoListController.currentPlayer.pause();
    _videoListController.dispose();
    super.dispose();
  }

the error comes on this line on pause method of the video

 @override
  Future<void> pause({bool showPauseIcon: false}) async {
    await Future.wait(_actLocks);
    _actLocks.clear();
    await init();
    if (!prepared) return;
    if (_disposeLock != null) {
      await _disposeLock?.future;
    }
    await this.controller.pause();
    **------------_showPauseIcon.value = true;------------**
  }

@mjl0602 looking for your help

@gautamenbake
Copy link
Author

This comes if video properly loaded and you closes the videoplayer

Once you have called dispose() on a ValueNotifier, it can no longer be used.
E/flutter (11303): #0 ChangeNotifier._debugAssertNotDisposed.
package:flutter/…/foundation/change_notifier.dart:114
E/flutter (11303): #1 ChangeNotifier._debugAssertNotDisposed
package:flutter/…/foundation/change_notifier.dart:120

When player is loading to load a video

════════ Exception caught by foundation library ════════════════════════════════
A TikTokVideoListController was used after being disposed.

@gautamenbake
Copy link
Author

@mjl0602 pls answer

@mjl0602
Copy link
Owner

mjl0602 commented Mar 8, 2022

Why the pause method called after dispose? You can simply remove player.showPauseIcon.dispose() in TikTokVideoListController.dispose to avoid this error.

@mjl0602 mjl0602 closed this as completed Sep 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants