toWebOptions method

Map<String, dynamic> toWebOptions()

Converts the options to a map that can be passed to the web function call.

Implementation

Map<String, dynamic> toWebOptions() {
  return <String, dynamic>{
    'flatten': flatten,
    'incremental': incremental,
    'excludeAnnotations': excludeAnnotations,
    'saveForPrinting': saveForPrinting,
    'outputFormat': outputFormat,
    'optimize': optimize,
    'includeComments': includeComments,
    'permissions': {
      'documentPermissions': permissions?.map((e) => e.name).toList() ?? [],
      'userPassword': userPassword,
      'ownerPassword': ownerPassword,
    }..removeWhere((key, value) => value == null)
  }..removeWhere((key, value) =>
      value == null ||
      value is List && value.isEmpty ||
      value is Map && value.isEmpty);
}