baxcloud_client 2.0.3 copy "baxcloud_client: ^2.0.3" to clipboard
baxcloud_client: ^2.0.3 copied to clipboard

BaxCloud Flutter SDK for realtime media — live streaming, calls, chat UI kits, and room APIs.

example/lib/main.dart

import 'package:baxcloud_client/baxcloud_client.dart';
import 'package:flutter/material.dart';

import 'config.dart';
import 'screens/live_stream_screen.dart';
import 'screens/rooms_screen.dart';
import 'screens/video_call_screen.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();

  BaxCloudQuickStart.init(
    projectId: AppConfig.projectId,
    apiKey: AppConfig.apiKey,
    bundleId: AppConfig.bundleId.isEmpty ? null : AppConfig.bundleId,
  );

  runApp(const BaxCloudExampleApp());
}

class BaxCloudExampleApp extends StatelessWidget {
  const BaxCloudExampleApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'BaxCloud Examples',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: const Color(0xFF0F766E)),
        useMaterial3: true,
      ),
      home: const HomeScreen(),
    );
  }
}

class HomeScreen extends StatelessWidget {
  const HomeScreen({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('BaxCloud Examples')),
      body: ListView(
        padding: const EdgeInsets.all(16),
        children: [
          if (!AppConfig.hasCredentials) ...[
            Card(
              color: Theme.of(context).colorScheme.errorContainer,
              child: const Padding(
                padding: EdgeInsets.all(16),
                child: Text(
                  'Set your project ID and client API key in lib/config.dart '
                  '(or pass --dart-define=BAXCLOUD_PROJECT_ID=… and '
                  'BAXCLOUD_API_KEY=…).',
                ),
              ),
            ),
            const SizedBox(height: 16),
          ],
          _ExampleTile(
            title: 'Live stream',
            subtitle: 'Host a room with BaxcloudLiveStreamingView',
            onTap: () => Navigator.of(context).push(
              MaterialPageRoute(builder: (_) => const LiveStreamScreen()),
            ),
          ),
          _ExampleTile(
            title: 'Video call',
            subtitle: '1:1 call with BaxcloudVideoCallView',
            onTap: () => Navigator.of(context).push(
              MaterialPageRoute(builder: (_) => const VideoCallScreen()),
            ),
          ),
          _ExampleTile(
            title: 'List rooms',
            subtitle: 'GET /v1/rooms via BaxCloudClient.listRooms()',
            onTap: () => Navigator.of(context).push(
              MaterialPageRoute(builder: (_) => const RoomsScreen()),
            ),
          ),
        ],
      ),
    );
  }
}

class _ExampleTile extends StatelessWidget {
  const _ExampleTile({
    required this.title,
    required this.subtitle,
    required this.onTap,
  });

  final String title;
  final String subtitle;
  final VoidCallback onTap;

  @override
  Widget build(BuildContext context) {
    return Card(
      child: ListTile(
        title: Text(title),
        subtitle: Text(subtitle),
        trailing: const Icon(Icons.chevron_right),
        onTap: onTap,
      ),
    );
  }
}
0
likes
60
points
179
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

BaxCloud Flutter SDK for realtime media — live streaming, calls, chat UI kits, and room APIs.

Homepage

License

MIT (license)

Dependencies

flutter, http, livekit_client, package_info_plus, vector_math, wakelock_plus

More

Packages that depend on baxcloud_client