startRecording method
used to start native recording at sample rate 44100 save the output file int the given filePath
Implementation
Future<bool> startRecording({String? filePath}) async {
final filePaths = filePath ?? await _getRecordingPath();
// Ensure directory exists
final file = File(filePaths);
await file.parent.create(recursive: true);
try {
log('started recording at $filePaths');
final result = await _channel.invokeMethod('startRecording', {
'filePath': filePaths,
});
return result ?? false;
} catch (e) {
log('Error starting recording: $e');
return false;
}
}