I'm working on unit tests in Flutter and i want to build tests for the "package:video_player". I have build other unit tests for this project but i can't seem to figure out how to test this part. When i try to call the InitState() in the VideoPlayerScreenState class from the package, in my mainclass it works. But in my unit test the controller stays null and i'm not sure how to mount this class to a test widget so i can use getState.
I was hoping if someone has an example how to initialize a VideoPlayerController and set it up for testing? Just the first steps of setting the test up i can't get figured out. Once i have this starting point i can build the other tests for this project further. For testing purposes i need a VideoPlayerController that is initialized correctly and that i can acces GetState from a widget.
Once the VideoPlayerController would be initialized i would like to test the methods in unit testing. Just to check for example if playing, pausing etc works. But since i can't get it to initialize properly inside of a unit test, i can't get any further with this. This question is mainly focussed i think of the correct structure and order of testing this class.
Things i've tried before: I've tried to put my working code from the main class copy paste it inside of the unit test. Also i've tried to make inside of my main class a duplicate method for testing purposes. I've tried different order of methods inside of the unit test.
What i expected: I expected for the controller to me initialized and able to respond. But the controller remained null and i also got a GetState (no such state, widget not mounted) error.