1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-08 13:58:47 +00:00

desktop_photo_search: getSavePath is deprecated (#1910)

This PR fixes a [CI
breakage](https://github.com/flutter/samples/actions/runs/5362518576/jobs/9729453534):

```console
Analyzing fluent_ui...

   info - lib/src/widgets/unsplash_search_content.dart:51:38 - 'getSavePath' is deprecated and shouldn't be used. Use getSaveLocation instead. Try replacing the use of the deprecated member with the replacement. - deprecated_member_use

1 issue found.
Error: Process completed with exit code 1.
```

## Pre-launch Checklist

- [x] I read the [Flutter Style Guide] _recently_, and have followed its
advice.
- [x] I signed the [CLA].
- [x] I read the [Contributors Guide].
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-devrel
channel on [Discord].

<!-- Links -->
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[CLA]: https://cla.developers.google.com/
[Discord]: https://github.com/flutter/flutter/wiki/Chat
[Contributors Guide]:
https://github.com/flutter/samples/blob/main/CONTRIBUTING.md
This commit is contained in:
Brett Morgan
2023-06-25 10:44:16 +10:00
committed by GitHub
parent 5ec584e819
commit eac6afac14
4 changed files with 19 additions and 15 deletions

View File

@@ -48,7 +48,7 @@ class _UnsplashSearchContentState extends State<UnsplashSearchContent> {
? PhotoDetails(
photo: photoSearchModel.selectedPhoto!,
onPhotoSave: (photo) async {
final path = await getSavePath(
final saveLocation = await getSaveLocation(
suggestedName: '${photo.id}.jpg',
acceptedTypeGroups: [
const XTypeGroup(
@@ -58,12 +58,12 @@ class _UnsplashSearchContentState extends State<UnsplashSearchContent> {
),
],
);
if (path != null) {
if (saveLocation != null) {
final fileData =
await photoSearchModel.download(photo: photo);
final photoFile =
XFile.fromData(fileData, mimeType: 'image/jpeg');
await photoFile.saveTo(path);
await photoFile.saveTo(saveLocation.path);
}
},
)