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

Flutter platform layer for LocalAI Kit: storage, mic capture, audio playback, network policy, device probing, permissions and lifecycle hooks.

example/local_ai_flutter_example.dart

// ignore_for_file: avoid_print
import 'package:flutter/widgets.dart';
import 'package:local_ai_flutter/local_ai_flutter.dart';

/// Minimal usage of the platform services in `local_ai_flutter`.
///
/// Run with `flutter run example/local_ai_flutter_example.dart` from an app
/// shell, or copy the calls below into your own `main()`.
Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();

  // Resolve on-device storage for downloaded models.
  final storage = await FlutterStoragePaths.resolve();
  print('Model root: ${storage.rootDir}');

  // Request microphone access before starting a voice session.
  final permissions = PermissionGate();
  if (!await permissions.hasMicrophone()) {
    await permissions.ensureMicrophone();
  }

  // Probe the device for LLM/runtime capability hints (RAM, accelerators).
  final probe = FlutterDeviceProbe();
  final capabilities = await probe.probe();
  print('Detected accelerators: ${capabilities.accelerators}');

  // React to connectivity changes when deciding whether to fetch a model.
  final network = FlutterNetworkPolicy();
  final canDownload = await network.canDownload(wifiOnly: true);
  print('Wi-Fi download allowed: $canDownload');
}
0
likes
160
points
194
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Flutter platform layer for LocalAI Kit: storage, mic capture, audio playback, network policy, device probing, permissions and lifecycle hooks.

Repository (GitHub)
View/report issues

License

Apache-2.0 (license)

Dependencies

connectivity_plus, device_info_plus, flutter, flutter_soloud, local_ai_core, path_provider, permission_handler, record

More

Packages that depend on local_ai_flutter