我正在尝试创建一个新文件并在 Flutter 中写入它,但收到一条错误,指出: [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: FileSystemException: Cannot create file, path = ' /data/user/0/com.micharski.d_ball/app_flutter/levels/level101.json'(操作系统错误:没有这样的文件或目录,errno = 2)
这是我的代码(我正在使用 path_provider 插件):
class LevelFactory {
Level level;
File levelFile;
Future<File> _createLevelFile() async {
Directory appDocDir = await getApplicationDocumentsDirectory();
String appDocPath = appDocDir.path;
File file = File('levels/level101.json');
return file.create();
}
Future<void> createLevel() async {
if(level != null){
level = null;
}
levelFile = await _createLevelFile();
print(levelFile);
}
}
Run Code Online (Sandbox Code Playgroud)
驱动程序类内部:
var customLvl = new LevelFactory();
customLvl.createLevel();
Run Code Online (Sandbox Code Playgroud)
出于调试目的,我将其添加到 _createLevelFile() 中:
Directory dir2 = Directory('$appDocPath/levels');
print('DIR2 PATH: …Run Code Online (Sandbox Code Playgroud) 我正在使用arm64,我正在尝试找到一种将32位寄存器复制到64位寄存器的方法,因为mov x1, w6返回操作数不匹配错误,因为您无法使用以下命令将32位寄存器复制到64位寄存器只是一个简单的移动指令。