toJson method

Map<String, dynamic> toJson()

Converts options to a JSON map, omitting null values.

Implementation

Map<String, dynamic> toJson() => {
      if (userPassword != null) 'userPassword': userPassword,
      if (ownerPassword != null) 'ownerPassword': ownerPassword,
      if (flatten != null) 'flatten': flatten,
      if (incremental != null) 'incremental': incremental,
      if (excludeAnnotations != null)
        'excludeAnnotations': excludeAnnotations,
      if (saveForPrinting != null) 'saveForPrinting': saveForPrinting,
      if (permissions != null)
        'permissions':
            permissions!.where((p) => p != null).map((p) => p!.name).toList(),
      if (pdfVersion != null) 'pdfVersion': pdfVersion?.name,
      if (includeComments != null) 'includeComments': includeComments,
      if (outputFormat != null) 'outputFormat': outputFormat,
      if (optimize != null) 'optimize': optimize,
    };