GeekyAnts / flick-video-player

MIT License
270 stars 269 forks source link

null value #276

Closed Pawankant87 closed 3 months ago

Pawankant87 commented 6 months ago

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Null check operator used on a null value

0 FlickVideoManager._changeVideo (package:flick_video_player/src/manager/video_manager.dart:144:57)

rohitprajapatii commented 6 months ago

@Pawankant87 Try, registering the context in your FlickManager using the registerContext method when initializing. This error occurs when you're not registering the context and then use the handleChangeVideo method. Feel free to let us know if you get any issues.

yhelwa commented 6 months ago

@rohitprajapatii I tried that but still getting same null check operator error.

void initFlickManager() { flickManager = FlickManager( videoPlayerController: _videoPlayerController, onVideoEnd: () async { if (!widget.video.done) { widget.video.done = true; await widget.addVideoRewardsAndActivity(); } }); flickManager.registerContext(context); }

yairsts commented 5 months ago

this line couse the error.

if (autoPlay && ModalRoute.of(_flickManager._context!)!.isCurrent)

because has initialized before the contractor of FlickManager

geekruchika commented 4 months ago

Added a fix in this PR: https://github.com/GeekyAnts/flick-video-player/pull/284/files.

harpreetslabs commented 3 months ago

Added a fix in this PR: https://github.com/GeekyAnts/flick-video-player/pull/284/files.

Yes it fixed but we have to update package code, do you have another solution for now?

geekruchika commented 3 months ago

I'll merge release this soon.

geekruchika commented 3 months ago

Released 0.9.0.