endSessionAndStopCasting method
Ends the current session and stops casting if one sender device is connected; otherwise, optionally stops casting if multiple sender devices are connected. Use the stopCasting parameter to indicate whether casting on the receiver should stop when the session ends. This parameter only applies when multiple sender devices are connected. For example, the same app is open on multiple sender devices and each sender device has an active Cast session with the same receiver device. If you set stopCasting to YES, the receiver app stops casting when multiple devices are connected. If stopCasting is NO and other devices have an active session, the receiver keeps playing. If only one sender device is connected, the receiver app stops casting the media and ignores the stopCasting value, even if it's set to NO. Parameters stopCasting Whether casting on the receiver should stop when the session ends. Only used when multiple sender devices are connected. Returns YES if the operation to end the session started successfully, NO if there is no session currently established or if the operation could not be started.
Implementation
@override
Future<bool> endSessionAndStopCasting() async {
return await _channel.invokeMethod('endSessionAndStopCasting');
}