Install the Flutter SDK
Add the recommended package, implement a token provider, and create one SDK per app-user session.
Requirements
- Flutter 3.38 or newer for the released v_chat_flutter candidate.
- Dart 3.10 or newer and below Dart 4.
- A V Chat application ID and HTTPS API base URL.
- An authenticated endpoint on your backend that returns a short-lived app-user token.
Add the dependency
# Client + lifecycle + persistence, build your own UI
flutter pub add v_chat_flutter
# Or the complete umbrella with optional widgets
flutter pub add v_chat_sdkCreate and connect the SDK
import 'package:v_chat_flutter/v_chat_flutter.dart';
final sdk = await VChatFlutterSdk.create(
options: VChatClientOptions(
appId: '00000000-0000-4000-8000-000000000001',
apiBaseUri: Uri.parse('https://api.example.com'),
),
tokenProvider: const BackendTokenProvider(),
databaseName: 'vchat-current-profile',
);
sdk.lifecycleBinding.attach();
await sdk.client.connectUser(userId: currentUserId);
final conversations = await sdk.client.queryCurrentUserConversations(
limit: 25,
);
renderConversations(conversations.items);Create one SDK per logical app-user session. Plain HTTP is rejected unless explicitly enabled for a loopback development endpoint.
Disconnect and dispose
try {
await runAuthenticatedChatSession(sdk.client);
} finally {
await sdk.client.disconnect();
await sdk.dispose();
}Dispose all stream subscriptions, controllers, and focus nodes owned by your application. The SDK closes only the resources it owns.