Repository navigation
[ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: FileSystemException: Cannot open file, path = '...' (OS Error: No such file or directory, errno = 2) #43472
Description
Activity
- changed the title
[-][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)[/-][+][ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: FileSystemException: Cannot open file, path = '...' (OS Error: No such file or directory, errno = 2)[/+]on Oct 25, 2019 Hi @103style
could you please provide yourflutter run --verbose.
Thank you- addedwaiting for responseThe Flutter team cannot make further progress on this issue until the original reporter respondsThe Flutter team cannot make further progress on this issue until the original reporter responds
on Oct 25, 2019 Hi @103style
could you please provide yourflutter run --verbose.
Thank youi just copy the log after install apk, if you need more ,please let me know. thanks a lot.
- removedwaiting for responseThe Flutter team cannot make further progress on this issue until the original reporter respondsThe Flutter team cannot make further progress on this issue until the original reporter responds
on Oct 25, 2019 - addedp: path_providerPlugin that provides resolved paths to some platform directoriesPlugin that provides resolved paths to some platform directories
on Oct 25, 2019 we are using mqtt_client library, and i coding like code file
line 42-45, and then the error info appear.maybe this will help you to get more info.
Now I am ready to do like this:
first i witre a file in the getApplicationDocumentsDirectory dir,
and the use thecontext.setTrustedCertificates(file.path);Future<int> main() async { final SecurityContext context = SecurityContext.defaultContext; String crtPath = await _getLocalFile("client.crt"); context.setTrustedCertificates(crtPath); client.securityContext = context; client.setProtocolV311(); return 0; } Future<String> _getLocalFile(String filename) async { String dir = (await getApplicationDocumentsDirectory()).path; File file = new File('$dir/$filename'); bool exist = await file.exists(); log('exist = $exist'); if (!exist) { file.writeAsString('''-----BEGIN CERTIFICATE----- MIIDQDCCAigCCQCPNMDXN3AfRjANBgkqhkiG9w0BAQsFADBmMQswCQYDVQQGEwJF N12AHBWWGeOir6+09zdT1ULBgbwDc8l9mN1G94xe/7UUdN9xNmDe2wV8V181Eau9 jIL5iFFAogR+hHP9H45VLU3QdNY= -----END CERTIFICATE----- '''); } String contents = await file.readAsString(); log(contents); return file.path; }I suggest add a function to get the file's path which is config in the
pubspec.yaml assets:,
if the function is exist now , please let konw,
thank a lot.void setAlpnProtocols(List<String> protocols, bool isServer); void usePrivateKey(String file, {String password}); void usePrivateKeyBytes(List<int> keyBytes, {String password}); void setTrustedCertificates(String file, {String password}); void setTrustedCertificatesBytes(List<int> certBytes, {String password}); void useCertificateChain(String file, {String password}); void useCertificateChainBytes(List<int> chainBytes, {String password}); void setClientAuthorities(String file, {String password}); void setClientAuthoritiesBytes(List<int> authCertBytes, {String password});This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.- locked as resolved and limited conversation to collaborators
on Aug 26, 2021 - addedpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.
on Jul 5, 2023
Error info:
[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 and dart version:
project file dir like this:
when i use the following code, and this error is appear
this is when i use mqtt_client library, and i also comment in mqtt_client's issues
and i try config the path in the
pubspec.yamland
rootBundle.loadString('crt/crt/client.crt')haven't show the error,but when i load the
client.crtuse following code, and the same errorOS Error: No such file or directory, errno = 2appearthanks.