Skip to main content

API Client

The VerrifloClient provides a simple way to interact with the Verriflo Live API directly from your Flutter app. It handles authentication, retries, and error parsing for you.

Setup​

Initialize the client with your API base URL and Organization ID.

final client = VerrifloClient(
baseUrl: 'https://api.verriflo.com',
organizationId: 'your-org-id', // From Verriflo Dashboard
);

Creating a Room​

To create a new room (e.g., for a teacher starting a class):

try {
final response = await client.createRoom(CreateRoomRequest(
roomId: 'math-101',
title: 'Algebra II',
participant: Participant(
uid: 'teacher-1',
name: 'Mr. Teacher',
role: ParticipantRole.teacher,
),
customization: Customization(
theme: ClassroomTheme.dark,
allowRecording: true,
),
));

print('Iframe URL: ${response.iframeUrl}');
// Navigate to player with response.iframeUrl
} on VerrifloException catch (e) {
print('Failed to create room: ${e.message}');
}

Joining a Room​

To join an existing room (e.g., for a student):

try {
final response = await client.joinRoom('math-101', JoinRoomRequest(
participant: Participant(
uid: 'student-1',
name: 'Alice Student',
role: ParticipantRole.student,
),
customization: Customization(
showLobby: false,
),
));

print('Iframe URL: ${response.iframeUrl}');
// Navigate to player with response.iframeUrl
} catch (e) {
// Handle error
}

Error Handling​

The client throws typed exceptions for easier error handling:

  • VerrifloNetworkException: Connection issues or timeouts.
  • VerrifloAuthException: Invalid Organization ID.
  • VerrifloRoomNotFoundException: The requested room does not exist.
  • VerrifloValidationException: Missing required fields.
  • VerrifloRateLimitException: Too many requests.