flutter_whisper_kit_apple 0.3.0
flutter_whisper_kit_apple: ^0.3.0 copied to clipboard
iOS and macOS implementation of the flutter_whisper_kit plugin, providing on-device speech recognition and transcription capabilities using WhisperKit.
flutter_whisper_kit_apple #
A common Apple platform implementation for the flutter_whisper_kit plugin.
Usage #
This package provides the iOS and macOS platform-specific implementation for the flutter_whisper_kit plugin. It is not intended for direct use by application developers.
Platform-specific implementations are registered automatically and used by the main flutter_whisper_kit package. You do not need to interact with this package directly.
🧠 DeepWiki #
Platform Support #
This package specifically supports:
| Platform | Minimum Version |
|---|---|
| iOS | 16.0+ |
| macOS | 13.0+ |
Implementation Details #
Flutter WhisperKit Apple provides the native implementation that connects Flutter applications to Apple's WhisperKit framework. It handles:
- Native integration with WhisperKit for iOS and macOS
- Model downloading and management
- Audio processing and transcription
- Real-time streaming of transcription results
- Platform-specific optimizations
Architecture #
The implementation uses:
- Swift for native code
- Pigeon for type-safe communication between Flutter and native code
- CoreML for optimized model inference
- AVFoundation for audio capture and processing
For Plugin Developers #
If you're working on extending or maintaining this plugin:
Key Components #
- FlutterWhisperKitApplePlugin: Main plugin class that registers with the Flutter engine
- WhisperKitApiImpl: Implementation of the Pigeon-generated interface
- TranscriptionStreamHandler: Manages streaming transcription results back to Flutter
Native Implementation #
The native implementation:
- Configures WhisperKit with compute options
- Manages model downloading and storage
- Handles audio file transcription
- Processes real-time audio from the microphone
- Streams transcription results back to Flutter
Error Codes #
The plugin uses the following error code system to report errors:
| Error Code | Category | Description |
|---|---|---|
| 1000-1999 | Model Initialization and Loading | Errors related to model initialization and loading |
| 1001 | Model Initialization | Model variant is required |
| 1002 | Model Initialization | Failed to initialize WhisperKit |
| 1003 | Model Loading | Failed to get model folder |
| 1005 | Model Loading | Failed to download model |
| 2000-2999 | Transcription and Processing | Errors related to audio transcription and processing |
| 2001 | Transcription | WhisperKit instance not initialized. Call loadModel first |
| 2002 | Transcription | Failed to serialize transcription result |
| 2003 | Transcription | Failed to create JSON string from transcription result |
| 2004 | Transcription | Transcription result is nil |
| 3000-3999 | Recording and Audio Capture | Errors related to recording functionality |
| 3001 | Recording | WhisperKit instance not initialized. Call loadModel first |
| 3002 | Recording | Microphone access was not granted |
| 3003 | Recording | Not enough audio data for transcription |
| 4000-4999 | File System and Permissions | Errors related to file access and permissions |
| 4001 | File System | Cannot write to model directory |
| 4002 | File System | Audio file does not exist at specified path |
| 4003 | File System | No read permission for audio file at specified path |
| 5000-5999 | Configuration and Parameters | Errors related to configuration and input parameters |
| 5001 | Parameters | File path is required |