所以我的代码的一部分是
Future<void> _loadModel() async {
final bytes =
await rootBundle.load('assets/deepspeech-0.9.3-models.tflite');
final directory = (await getApplicationDocumentsDirectory()).path;
而且我不断收到错误:
The method 'getApplicationDocumentsDirectory' isn't defined for the type '_MyAppState'.
Try correcting the name to the name of an existing method, or defining a method named 'getApplicationDocumentsDirectory'
我该怎么办?请帮帮我!
答案 0 :(得分:1)
您必须通过在终端中运行 flutter pub add path_provider
来安装路径提供程序包。如果您已经安装了它。检查您是否将其导入到您的文件中。