fluttercommunity / fluttercommunity/chewie
LateInitializationError: Field 'chewieController' has not been initialized. On Android
- Dominant language
- Dart
- Stars
- 2.1k
- Forks
- 1.1k
- Avg merge
- 6d 8h
- Merged PRs (30d)
- 6
Description
Code :
```
Future initController() async {
_videoPlayerController = VideoPlayerController.network(widget.url);
await _videoPlayerController?.initialize();
_chewieController = ChewieController(
videoPlayerController: _videoPlayerController!,
autoPlay: widget.autoPlay,
looping: widget.looping,
aspectRatio: widget.aspectRatio,
allowPlaybackSpeedChanging: widget.allowPlaybackSpeedChanging,
allowFullScreen: widget.allowFullScreen,
customControls: VideoControlsWidget(
overlayUI: _videoPlayTopBar(),
bottomGradient: _blackLinearGradient(),
));
setState(() {
});
}
@override
Widget build(BuildContext context) {
double width = MediaQuery.of(context).size.width;
double height = width / widget.aspectRatio;
if (!(_videoPlayerController?.value.isInitialized ?? false) || _chewieController == null) {
return Container(
width: width,
height: height,
alignment: Alignment.center,
child: const CircularProgressIndicator(),
);
} else {
return Container(
width: width,
height: height,
child: Chewie(
controller: _chewieController!,
),
);
}
}
@override
void dispose() {
_videoPlayerController?.dispose();
_chewieController?.dispose();
super.dispose();
}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.