setForegroundSessionId method
Sets the foreground session.
Throws if the server reports failure.
Implementation
Future<void> setForegroundSessionId(String sessionId) async {
_ensureConnected();
final result = await _connection!.sendRequest(
'session.setForeground',
{'sessionId': sessionId},
const Duration(seconds: 5),
);
final map = result as Map<String, dynamic>;
if (map['success'] != true) {
final error =
map['error'] as String? ?? 'Failed to set foreground session';
throw Exception(error);
}
}