dispose method
Releases the video resources.
This should be called when you're done with the video to free up resources. After calling dispose, this NativeVideoRenderer instance should not be used.
Implementation
Future<void> dispose() async {
if (_isDisposed) {
return;
}
_isDisposed = true;
try {
await MethodHandler.invokeNativeMethod(
'releaseVideo',
arguments: {'videoId': videoId},
);
} catch (e) {
debugPrint('Error releasing video: $e');
}
}