Skip to content

[Flutter SDK] Missing configuration validation for LLM, STT, and TTS components (parity with Swift/Kotlin) #450

@Prasham27

Description

@Prasham27

Component

Android SDK

Bug Description

The Flutter SDK is missing validate() implementations for LLMConfiguration,
STTConfiguration, and TTSConfiguration. Both Swift and Kotlin SDKs enforce
parameter range validation on these types, but Flutter does not — allowing
invalid values to pass through FFI directly to the C++ layer.

The ComponentConfiguration protocol already requires validate()
(defined in lib/core/protocols/component/component_configuration.dart)
and VADConfiguration correctly implements it. LLM and STT configuration
classes are missing entirely, and TTSConfiguration exists but has no
validation.

Current state:

  • LLMConfiguration.validate() → Swift ✅ Kotlin ✅ Flutter ❌ (class missing)
  • STTConfiguration.validate() → Swift ✅ Kotlin ✅ Flutter ❌ (class missing)
  • TTSConfiguration.validate() → Swift ✅ Kotlin ✅ Flutter ❌ (no validation)
  • VADConfiguration.validate() → Swift ✅ Kotlin ✅ Flutter ✅

I have a working implementation with 31 passing unit tests covering valid
defaults, boundary values, and all invalid ranges for all four configurations.
Should I raise a PR for this?

Steps to Reproduce

  1. Create a Flutter app using the RunAnywhere Flutter SDK

  2. Pass an invalid configuration value, for example:

    final config = LLMConfiguration(temperature: -5, maxTokens: 0);
    await RunAnywhere.generateStream('Hello', configuration: config);

  3. Observe that no Dart-level error is thrown

  4. The invalid value crosses the FFI bridge to the C++ inference layer

Expected Behavior

Passing an out-of-range value should throw a clear Dart exception before
reaching native code:

SDKError.validationFailed('Temperature must be between 0 and 2.0')

This is the existing behaviour in both the Swift and Kotlin SDKs, and is
already the pattern for VADConfiguration in Flutter.

Environment

  • Flutter SDK: 3.41.4 (stable)
  • Package: sdk/runanywhere-flutter/packages/runanywhere/
  • Platform: Windows 11
  • Affected file (TTS): lib/features/tts/system_tts_service.dart
  • Missing files: lib/features/llm/llm_configuration.dart,
    lib/features/stt/stt_configuration.dart
  • Reference pattern: lib/features/vad/vad_configuration.dart
  • Protocol: lib/core/protocols/component/component_configuration.dart

Logs/Screenshots

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions