flutter::[错误:flutter/lib/ui/ui_start_state.cc(209)]未处理的异常:Fi


E/flutter ( 7797): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: 
FileSystemException: Directory listing failed, path = '/storage/emulated/0/Android/data/com.example.myfilename/files/Audiorecords/' 
(OS Error: No such file or directory, errno = 2)

我收到了上面的错误,我该如何修复它?

这是我代码的一部分。

class FlutterAudioRecorder {
static const MethodChannel _channel = const MethodChannel("com.example.recorder_ttest");
static const String DEFAULT_EXTENSION = '.m4a';
static LocalFileSystem fs = LocalFileSystem();
String? _path;
String? _extension;
Recording? _recording;
String? _sampleRate;
Future? _initRecorder;
Future? get initialized => _initRecorder;
Recording? get recording => _recording;
FlutterAudioRecorder(String path, {AudioFormat? audioFormat, String sampleRate = "16000"}) {
_initRecorder = _init(path, audioFormat, sampleRate);
}

我的代码与原始代码不同的部分是

static const MethodChannel _channel = const MethodChannel('flutter_audio_recorder2');  //original code

我认为这部分有问题。如何查找原始代码中"flatter_audio_recorder2"的定义位置?

这里的问题与MethodChannel无关,错误FileSystemException表示它找不到路径'/storage/emulated/0/Android/data/com.example.myfilename/files/Audiorecords/'。验证路径/目录是否存在。

最新更新