pickSaveFile static method

Future<String?> pickSaveFile({
  1. String? defaultName,
})

Picks a save file location and return a String path. You can optionally specify a default file name via defaultName. If the user cancels the picker, it returns null.

Implementation

static Future<String?> pickSaveFile({String? defaultName}) async {
  if (Platform.isMacOS) {
    final macosPicker = MacosFilePicker();
    final res = await macosPicker.pick(MacosFilePickerMode.saveFile,
        defaultName: defaultName);
    if (res == null) {
      return null;
    }
    return res.first.path;
  }
  final res = await getSaveLocation(suggestedName: defaultName);
  return res?.path;
}