getCertificate method Null safety

Future<SslCertificate?> getCertificate()

Gets the SSL certificate for the main top-level page or null if there is no certificate (the site is not secure).

Official Android API: https://developer.android.com/reference/android/webkit/WebView#getCertificate()

Implementation

Future<SslCertificate?> getCertificate() async {
  Map<String, dynamic> args = <String, dynamic>{};
  Map<String, dynamic>? sslCertificateMap =
      (await _channel.invokeMethod('getCertificate', args))
          ?.cast<String, dynamic>();
  return SslCertificate.fromMap(sslCertificateMap);
}