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:
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 file dir like this:
project
-crt
--crt
---cilent.crt
when i use the following code, and this error is appear
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'));
}
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.yaml
flutter:
assets:
- crt/crt/client.crt
and rootBundle.loadString('crt/crt/client.crt') haven't show the error,
import 'dart:async' show Future;
import 'package:flutter/services.dart' show rootBundle;
Future<String> loadAsset() async {
return await rootBundle.loadString('crt/crt/client.crt');
}
but when i load the client.crt use following code, and the same error OS Error: No such file or directory, errno = 2 appear
final SecurityContext context = SecurityContext.defaultContext;
context.setTrustedCertificates('crt/crt/client.crt');
thanks.