whisper_edge 0.1.1
whisper_edge: ^0.1.1 copied to clipboard
On-device speech-to-text for Flutter, powered by whisper.cpp. Offline transcription with timestamps, language detection and model downloads, on iOS and Android.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:whisper_edge/whisper_edge.dart';
void main() {
runApp(const MyApp());
}
/// Minimal smoke-test app for the whisper_edge plugin.
///
/// It prints the whisper/ggml build info (which proves the native library
/// loads) and shows the typical usage flow in code. For a full app built on
/// this plugin, see the PopyTranscribe project.
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text('whisper_edge example')),
body: Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
const Text('Native build info:',
style: TextStyle(fontWeight: FontWeight.bold)),
const SizedBox(height: 8),
Expanded(
child: SingleChildScrollView(
child: Text(WhisperTranscriber.systemInfo),
),
),
const SizedBox(height: 16),
const Text(
'Usage:\n'
' final dir = await getApplicationSupportDirectory();\n'
' final path = await WhisperModelDownloader()\n'
' .download(WhisperModel.baseQ5_1, dir);\n'
' final t = await WhisperTranscriber.load(path);\n'
' final r = await t.transcribeWavFile(wavPath);\n'
' print(r.text);',
style: TextStyle(fontFamily: 'monospace', fontSize: 12),
),
],
),
),
),
);
}
}