xybrid_flutter 0.1.0-alpha6 copy "xybrid_flutter: ^0.1.0-alpha6" to clipboard
xybrid_flutter: ^0.1.0-alpha6 copied to clipboard

Xybrid Flutter SDK — run ML models on-device or in the cloud with intelligent hybrid routing and streaming inference.

example/example.md

Xybrid Flutter SDK Example #

Quick Start #

import 'package:xybrid_flutter/xybrid_flutter.dart';

Future<void> main() async {
  // Initialize the SDK (call once at app startup)
  await Xybrid.init();

  // Load a TTS model from the registry
  final loader = XybridModelLoader.fromRegistry('kokoro-82m');
  final model = await loader.load();

  // Run text-to-speech inference
  final result = await model.run(XybridEnvelope.text('Hello from Xybrid!'));

  // Access the audio output
  if (result.audioBytes != null) {
    print('Generated ${result.audioBytes!.length} bytes of audio');
  }
}

Loading with Progress #

final loader = XybridModelLoader.fromRegistry('kokoro-82m');

await for (final event in loader.loadWithProgress()) {
  switch (event) {
    case LoadProgress(:final progress):
      print('Downloading: ${(progress * 100).toInt()}%');
    case LoadComplete():
      final model = await loader.load();
      print('Model ready!');
    case LoadError(:final message):
      print('Error: $message');
  }
}

LLM Chat with Streaming #

final model = await XybridModelLoader.fromRegistry('qwen-2.5-0.5b').load();
final context = ConversationContext();

// Stream tokens as they're generated
await for (final token in model.chat(
  'What is machine learning?',
  context: context,
)) {
  stdout.write(token);
}

Full Example App #

See the complete Flutter example app with 8 demo screens: https://github.com/xybrid-ai/xybrid/tree/main/examples/flutter

0
likes
130
points
--
downloads

Publisher

verified publisherxybrid.ai

Weekly Downloads

Xybrid Flutter SDK — run ML models on-device or in the cloud with intelligent hybrid routing and streaming inference.

Repository (GitHub)
View/report issues
Contributing

Topics

#machine-learning #ai #inference #edge-computing

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

flutter, flutter_rust_bridge, freezed_annotation, path_provider, plugin_platform_interface

More

Packages that depend on xybrid_flutter

Packages that implement xybrid_flutter