embed_flutter 0.0.2 copy "embed_flutter: ^0.0.2" to clipboard
embed_flutter: ^0.0.2 copied to clipboard

unlisted

A powerful Flutter SDK that provides a powerful voice-enabled AI-agent functionality with real-time widget tree monitoring for screen context fetching and realtime voice communication.

Embed Flutter SDK #

A powerful Flutter SDK that provides a powerful voice-enabled AI-agent functionality with real-time widget tree monitoring for screen context fetching and realtime voice communication.

Table of Contents #

Installation #

Add the following dependency to your pubspec.yaml:

dependencies:
  embed_flutter: ^0.0.1

Then run:

flutter pub get

Android Configuration

Add the following permissions to your android/app/src/main/AndroidManifest.xml:

<uses-permission android:name="android.permission.RECORD_AUDIO" />

iOS Configuration

Add the following permissions to your ios/Runner/Info.plist:

<key>NSMicrophoneUsageDescription</key>
<string>This app needs access to microphone for voice calls.</string>

Getting Started #

Basic Usage #

Wrap your app's root widget with EmbedWidget to enable the embedded agent functionality:

import 'package:embed_flutter/embed_flutter.dart';

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: EmbedWidget(
        apiKey: 'your-api-key-here',
        child: Scaffold(
          appBar: AppBar(title: const Text('My App')),
          body: const Center(child: Text('Hello World!')),
        ),
      ),
    );
  }
}

Required Parameters #

  • apiKey (required): Your Revrag AI API key for authentication
  • child (required): The main content of your app

Optional Parameters #

  • showEmbedWidget (default: true): Controls whether the embedded widget is visible
  • embedUrl (default: null): Custom base URL for API endpoints

Examples #

Basic Integration #

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

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

  @override
  Widget build(BuildContext context) {
    return EmbedWidget(
      apiKey: 'your-api-key',
      child: Scaffold(
        appBar: AppBar(title: const Text('My App')),
        body: const Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              Text('Welcome to My App!'),
              SizedBox(height: 20),
              Text('The embedded agent is monitoring this screen.'),
            ],
          ),
        ),
      ),
    );
  }
}

Form with Monitoring #

class MyFormPage extends StatefulWidget {
  const MyFormPage({super.key});

  @override
  State<MyFormPage> createState() => _MyFormPageState();
}

class _MyFormPageState extends State<MyFormPage> {
  final _formKey = GlobalKey<FormState>();
  final _nameController = TextEditingController();

  @override
  Widget build(BuildContext context) {
    return EmbedWidget(
      apiKey: 'your-api-key',
      child: Scaffold(
        appBar: AppBar(title: const Text('My Form')),
        body: Form(
          key: _formKey,
          child: Padding(
            padding: const EdgeInsets.all(16.0),
            child: Column(
              children: [
                TextFormField(
                  controller: _nameController,
                  decoration: const InputDecoration(labelText: 'Name'),
                  validator: (value) {
                    if (value == null || value.isEmpty) {
                      return 'Please enter your name';
                    }
                    return null;
                  },
                ),
                const SizedBox(height: 20),
                ElevatedButton(
                  onPressed: () {
                    if (_formKey.currentState!.validate()) {
                      // Form is valid
                    }
                  },
                  child: const Text('Submit'),
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}

Custom Embed URL #

EmbedWidget(
  apiKey: 'your-api-key',
  embedUrl: 'https://custom-api.example.com',
  child: YourApp(),
)

Configuration #

Custom Base URL #

You can override the default base URL by providing the embedUrl parameter:

EmbedWidget(
  apiKey: 'your-api-key',
  embedUrl: 'https://your-custom-domain.com',
  child: YourApp(),
)

Permissions #

The SDK automatically handles the following permissions:

  • Microphone: Required for voice communication
  • Bluetooth: Required for Bluetooth audio devices
  • Bluetooth Connect: Required for Bluetooth device management

Permission Flow #

  1. Initial Check: SDK checks permission status on initialization
  2. Permission Request: Automatically requests permissions when starting a call
  3. User Guidance: Provides clear error messages if permissions are denied
  4. Background Handling: Manages permissions when app goes to background

Best Practices #

Performance #

  • Widget Tree Updates: The SDK optimizes widget tree extraction
  • API Calls: Efficient batching of widget tree data
  • Memory Management: Proper disposal of resources and listeners

Security #

  • API Key Protection: Never expose your API key in client-side code
  • Permission Handling: Request only necessary permissions
  • Data Validation: Validate all user inputs

User Experience #

  • Permission Requests: Explain why permissions are needed
  • Error Messages: Provide clear, actionable error messages
  • Loading States: Show appropriate loading indicators

Troubleshooting #

Common Issues #

  1. Widget Not Visible

    • Check showEmbedWidget parameter
    • Verify API key is valid
    • Check network connectivity
  2. Voice Call Issues

    • Ensure microphone permission is granted
    • Check device audio settings
    • Verify LiveKit token is valid
  3. Widget Tree Not Updating

    • Check widget tree handler initialization
    • Verify context is available
    • Check for widget disposal issues

License #

This project is licensed under the Non-Commercial License License - see the LICENSE file for details.

Support #

Changelog #

See CHANGELOG.md for a complete list of changes and version history.


0
likes
0
points
131
downloads

Documentation

Documentation

Publisher

verified publisherrevrag.ai

Weekly Downloads

A powerful Flutter SDK that provides a powerful voice-enabled AI-agent functionality with real-time widget tree monitoring for screen context fetching and realtime voice communication.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, flutter_webrtc, livekit_client, lottie, permission_handler, wave

More

Packages that depend on embed_flutter