initAndSetCertificate function

Future<void> initAndSetCertificate()

Should only called once, call init inside, and set certificate.

Implementation

Future<void> initAndSetCertificate() async {
  //
  // > init for tests
  //
  await init();
  //
  // > add certificate
  //
  if (!kIsWeb) {
    final data =
        await PlatformAssetBundle().load('assets/ca/lets-encrypt-r3.pem');
    SecurityContext.defaultContext
        .setTrustedCertificatesBytes(data.buffer.asUint8List());
  }
}