Records microphone audio to a temporary AAC file on iOS and Android, then returns the path. Reuse for voice notes, transcription, or chat voice messages; the caller deletes the file.
// Source: https://github.com/flutterclaw/flutterclaw | License: MIT | Copyright 2026 Franco Rapetti
// Provided via justclaw.it.com; keep this notice with the code.
/// Cross-platform voice recording service using the `record` package.
///
/// Records audio to a temporary file (AAC/m4a on iOS, AAC on Android) and
/// returns the file path when stopped. The caller is responsible for deleting
/// the file after use.
library;
import 'dart:io';
import 'package:path_provider/path_provider.dart';
import 'package:record/record.dart';
import 'package:logging/logging.dart';
final _log = Logger('VoiceRecordingService');
class VoiceRecordingService {
// record v5+ uses `AudioRecorder` (the old `Record` class was renamed).
final AudioRecorder _recorder = AudioRecorder();
bool _recording = f
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key