saveFile method

Future<Uri?> saveFile({
  1. required String fileName,
  2. required Uint8List bytes,
  3. required String mimeType,
  4. String? dialogTitle,
  5. String? initialDirectory,
  6. dynamic onFileSaving(
    1. FilePickerStatus
    )?,
  7. WindowsOptions windowsOptions = const WindowsOptions(),
  8. LinuxOptions linuxOptions = const LinuxOptions(),
  9. WebOptions webOptions = const WebOptions(),
})

Save the given bytes to a file with the given fileName, using the native save file dialog.

The fileName parameter specifies the default file name for saving (e.g. myFile.txt). The bytes parameter contains the raw byte data to write. The mimeType parameter specifies the MIME type of the file (e.g. application/pdf). The dialogTitle, if provided, will be used as the title for the save file dialog. The initialDirectory, if provided, will be used as the initial directory path for the save file dialog. The onFileSaving callback, if provided, is triggered when the save dialog changes status.

The windowsOptions, linuxOptions, and webOptions parameters allow platform-specific configurations for the save file dialog.

Returns the Uri of the saved file, or null if the user canceled the operation. Depending on the platform, the Uri.scheme may be file, content, http(s), data or blob.

Implementation

Future<Uri?> saveFile({
  required String fileName,
  required Uint8List bytes,
  required String mimeType,
  String? dialogTitle,
  String? initialDirectory,
  Function(FilePickerStatus)? onFileSaving,
  WindowsOptions windowsOptions = const WindowsOptions(),
  LinuxOptions linuxOptions = const LinuxOptions(),
  WebOptions webOptions = const WebOptions(),
}) async {
  throw UnimplementedError('saveFile() has not been implemented.');
}