kuralit_sdk 0.3.0 copy "kuralit_sdk: ^0.3.0" to clipboard
kuralit_sdk: ^0.3.0 copied to clipboard

Kuralit SDK for Flutter - A Flutter SDK for Kuralit realtime communication with WebSocket support

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:kuralit_sdk/kuralit.dart';

void main() {
  runApp(const MyApp());
}

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Kuralit Example',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Kuralit Example'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  late final KuralitWebSocketController _kuralitController =
      KuralitWebSocket.createController(
    config: KuralitWebSocketConfig(appId: 'your-kuralit-app-id'),
  );

  @override
  void dispose() {
    _kuralitController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: const Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text(
              'Tap the button below to open the Kuralit assistant.',
              style: TextStyle(fontSize: 16),
              textAlign: TextAlign.center,
            ),
            SizedBox(height: 12),
            Text(
              'Replace "your-kuralit-app-id" in main.dart with your Kuralit app ID.',
              style: TextStyle(fontSize: 14, color: Colors.grey),
              textAlign: TextAlign.center,
            ),
          ],
        ),
      ),
      floatingActionButton: KuralitAnchor(
        controller: _kuralitController,
        label: 'Ask for help',
      ),
    );
  }
}
1
likes
140
points
29
downloads

Documentation

API reference

Publisher

verified publisherkuralit.com

Weekly Downloads

Kuralit SDK for Flutter - A Flutter SDK for Kuralit realtime communication with WebSocket support

Homepage

License

MIT (license)

Dependencies

audio_session, flutter, permission_handler, record, web_socket_channel

More

Packages that depend on kuralit_sdk