convertFromHtmlFile static method Null safety

Future<File> convertFromHtmlFile(
  1. File htmlFile,
  2. String targetDirectory,
  3. String targetName
)

Creates PDF Document from File that contains HTML content Can throw a PlatformException or (unlikely) a MissingPluginException converting html to pdf

Implementation

static Future<File> convertFromHtmlFile(File htmlFile, String targetDirectory, String targetName) async {
  final generatedPdfFilePath = await _convertFromHtmlFilePath(htmlFile.path);
  final generatedPdfFile = FileUtils.copyAndDeleteOriginalFile(generatedPdfFilePath, targetDirectory, targetName);

  return generatedPdfFile;
}