createPdf method Null safety

Future<Uint8List?> createPdf(
  1. {IOSWKPDFConfiguration? iosWKPdfConfiguration}
)

Generates PDF data from the web view’s contents asynchronously. Returns null if a problem occurred.

iosWKPdfConfiguration represents the object that specifies the portion of the web view to capture as PDF data.

NOTE: available only on iOS 14.0+.

Official iOS API: https://developer.apple.com/documentation/webkit/wkwebview/3650490-createpdf

Implementation

Future<Uint8List?> createPdf(
    {IOSWKPDFConfiguration? iosWKPdfConfiguration}) async {
  Map<String, dynamic> args = <String, dynamic>{};
  args.putIfAbsent(
      'iosWKPdfConfiguration', () => iosWKPdfConfiguration?.toMap());
  return await _channel.invokeMethod('createPdf', args);
}