meetingEnded function
- {required MeetingEndedOptions options}
Handles the end of a meeting by showing an alert and performing a redirect if necessary.
This function takes an instance of MeetingEndedOptions which includes options for showing an alert message, redirecting to a URL, and updating the validation state.
If the event type is not 'chat', it displays an alert notifying that the event has ended.
If onWeb
is true and redirectURL
is provided, it redirects the user to the specified URL after a 2-second delay.
Otherwise, it calls updateValidated
to update the validation state.
Example usage:
final options = MeetingEndedOptions(
showAlert: (message, type, duration) => print("Alert: $message"),
redirectURL: "https://homepage.com",
onWeb: true,
eventType: "meeting",
updateValidated: (isValid) => print("Validation status: $isValid"),
);
await meetingEnded(options: options);
Implementation
Future<void> meetingEnded({required MeetingEndedOptions options}) async {
// Show an alert if the event type is not 'chat'
if (options.eventType != EventType.chat) {
options.showAlert!(
message: 'The meeting has ended. Redirecting to the home page...',
type: 'danger',
duration: 2000,
);
}
// Handle redirection or validation update
if (options.onWeb &&
options.redirectURL != null &&
options.redirectURL!.isNotEmpty) {
await Future.delayed(const Duration(seconds: 2));
// Here you could implement the actual redirection logic
// For example: window.location.href = options.redirectURL
} else if (options.updateValidated != null) {
await Future.delayed(const Duration(seconds: 2));
options.updateValidated!(false);
}
}