beam_ai_sdk 0.1.3 copy "beam_ai_sdk: ^0.1.3" to clipboard
beam_ai_sdk: ^0.1.3 copied to clipboard

The beam_ai_sdk enables easy integration of advanced AI features like NLP, image recognition, speech processing, and ML for effortless creation of intelligent applications.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:beam_ai_sdk/beam_ai_sdk.dart';

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

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

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String _platformVersion = 'Unknown';
  final _beamAiSdkPlugin = BeamAiSdk();
  dynamic output;

  Timer? timer;
  @override
  void initState() {
    super.initState();
  }

  Future<void> startBeam() async {
    String platformVersion;

    try {
      platformVersion =
          await _beamAiSdkPlugin.startBeamSdk() ?? 'Unknown platform version';
    } on PlatformException {
      platformVersion = 'Failed to get platform version.';
    }

    if (!mounted) return;

    setState(() {
      _platformVersion = platformVersion;
    });
  }

  stopBeam() async {
    await _beamAiSdkPlugin.stopBeamSdk();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        home: Scaffold(
            appBar: AppBar(
              title: const Text('Plugin Example'),
            ),
            body: Center(
                child: Stack(children: [
              _beamAiSdkPlugin.beamCamera(
                      beamId: "daIfQiR7SvBKTOThKwEq",
                      frameRate: 30,
                      window: 60.0,
                      updateEvery: 1) ??
                  SizedBox.shrink(),
              Positioned(
                  bottom: 20,
                  left: 0,
                  right: 0,
                  child: Column(children: [
                    const SizedBox(height: 20),
                    Text("Output ${output ?? ""}"),
                    const SizedBox(height: 20),
                    ElevatedButton(
                        onPressed: () {
                          startBeam();
                        },
                        child: const Text("Start Beam ")),
                    const SizedBox(height: 10),
                    ElevatedButton(
                        onPressed: () {
                          stopBeam();
                          setState(() {
                            timer?.cancel();
                            output = "";
                          });
                        },
                        child: const Text("Stop Beam ")),
                    ElevatedButton(
                        onPressed: () async {
                          timer = Timer.periodic(const Duration(seconds: 1),
                              (timer) async {
                            output = await _beamAiSdkPlugin.beamSdkOutput() ??
                                'Unknown platform version';
                            print("-------------$output");

                            setState(() {});
                          });
                        },
                        child: Text("Beam Output"))
                  ]))
            ]))));
  }
}
0
likes
130
points
27
downloads

Publisher

unverified uploader

Weekly Downloads

The beam_ai_sdk enables easy integration of advanced AI features like NLP, image recognition, speech processing, and ML for effortless creation of intelligent applications.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on beam_ai_sdk