[Flutter] OS Error: No such file or directory, errno = 2

[ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: FileSystemException: Cannot open file, path = '//crt/crt/cilent.crt' (OS Error: No such file or directory, errno = 2)

Flutter 1.9.1+hotfix.5 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 1aedbb1835 (7 days ago) • 2019-10-17 08:37:27 -0700
Engine • revision b863200c37
Tools • Dart 2.5.0

文件目录如下:

project
-crt
--crt
---cilent.crt

当我使用下面的代码去获取路径的时候会报上面的错误

import 'package:path/path.dart' as path;
Future<int> main() async {
    final String currDir =
    '${path.current}${path.separator}crt${path.separator}';
    final SecurityContext context = SecurityContext.defaultContext;
    context.setTrustedCertificates(currDir + path.join('crt','client.crt'));
}

有大佬知道原因吗 ?

感谢

阅读 6.4k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题