requestPromotion method
Implementation
Future<ViewerSessionSnapshot> requestPromotion() async {
final session = _snapshot.session;
if (session == null) {
_emit(_snapshot.copyWith(
error: 'Start the viewer session before requesting the floor.'));
return _snapshot;
}
if (provider.requestPromotion == null) {
_emit(_snapshot.copyWith(
error: 'This viewer session provider does not support promotion.'));
return _snapshot;
}
try {
await provider.requestPromotion!(session);
_emit(_snapshot.copyWith(
phase: ViewerSessionPhase.requested,
error: '',
));
} catch (error) {
_emit(_snapshot.copyWith(error: error.toString()));
}
return _snapshot;
}