getSaveLocation method
Future<FileSaveLocation?>
getSaveLocation({
- List<
XTypeGroup> ? acceptedTypeGroups, - SaveDialogOptions options = const SaveDialogOptions(),
Opens a file dialog for saving files and returns a file location at which to save.
Returns null
if the user cancels the operation.
Implementation
@override
Future<FileSaveLocation?> getSaveLocation({
List<XTypeGroup>? acceptedTypeGroups,
SaveDialogOptions options = const SaveDialogOptions(),
}) async {
final List<Map<String, Object>> serializedTypeGroups =
_serializeTypeGroups(acceptedTypeGroups);
// TODO(stuartmorgan): Add the selected type group here and return it. See
// https://github.com/flutter/flutter/issues/107093
final String? path = await _channel.invokeMethod<String>(
_getSavePathMethod,
<String, dynamic>{
if (serializedTypeGroups.isNotEmpty)
_acceptedTypeGroupsKey: serializedTypeGroups,
_initialDirectoryKey: options.initialDirectory,
_suggestedNameKey: options.suggestedName,
_confirmButtonTextKey: options.confirmButtonText,
},
);
return path == null ? null : FileSaveLocation(path);
}