endSession method
Implementation
Future<dynamic> endSession(String sessionId) async {
// cast required to avoid adding `collection` dependency
// https://github.com/dart-lang/sdk/issues/42947
final session = sessions.cast<CastSession?>().firstWhere((x) => x?.sessionId == sessionId, orElse: () => null);
if (session == null) {
return;
}
sessions.removeWhere((x) => x.sessionId == sessionId);
return session.close();
}