H5W3
当前位置:H5W3 > Flutter > 正文

【flutter】[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'));
}

有大佬知道原因吗 ?

感谢

回答

本文地址:H5W3 » 【flutter】[Flutter] OS Error: No such file or directory, errno = 2

评论 0

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址