addVirtualFile method

void addVirtualFile({
  1. required FileFormat format,
  2. required VirtualFileProvider provider,
  3. VirtualFileStorage? storageSuggestion,
})

Adds a virtual file to this data item. Virtual files are files generated on demand, possibly taking long time to complete (i.e. downloading from internet).

Only one virtual file per data item is supported. For clipboard, virtual files are supported on iOS and Windows. For Drag & Drop, virtual files are also supported on macOS. You can use virtualFileSupported to check whether current platform supports virtual files.

Implementation

void addVirtualFile({
  required FileFormat format,
  required VirtualFileProvider provider,
  VirtualFileStorage? storageSuggestion,
}) {
  assert(virtualFileSupported);
  _data.add(EncodedData([
    raw.DataRepresentation.virtualFile(
      format: format.providerFormat,
      virtualFileProvider: provider,
      storageSuggestion: storageSuggestion,
    )
  ]));
}