fileObject static method

String fileObject({
  1. required String fileNode,
  2. bool hasBase64 = true,
})

Build a JS object represeting file upload which will be uploaded.

fileNode is the node containing the file data. hasBase64 is a flag to indicate if the file has base64 data.

Implementation

static String fileObject({required String fileNode, bool hasBase64 = true}) => '''
  {
    'lastModified': $fileNode.lastModified,
    'lastModifiedDate': $fileNode.lastModifiedDate,
    'name': $fileNode.name,
    'size': $fileNode.size,
    'mimeType': $fileNode.type,
    ${hasBase64 ? "'base64': base64," : ""}
  };
''';