chore(mobile): Update share_file to latest version and migrate to using cross platform shareXFile (#1476)

* update share_plus and use sharexfile

* rename variable
This commit is contained in:
martyfuhry 2023-01-29 21:46:30 -05:00 committed by GitHub
parent 870a65fa6d
commit f23979024a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 41 deletions

View File

@ -22,7 +22,7 @@ class ShareService {
} }
Future<void> shareAssets(List<Asset> assets) async { Future<void> shareAssets(List<Asset> assets) async {
final downloadedFilePaths = assets.map((asset) async { final downloadedXFiles = assets.map<Future<XFile>>((asset) async {
if (asset.isRemote) { if (asset.isRemote) {
final tempDir = await getTemporaryDirectory(); final tempDir = await getTemporaryDirectory();
final fileName = basename(asset.remote!.originalPath); final fileName = basename(asset.remote!.originalPath);
@ -33,16 +33,16 @@ class ShareService {
isWeb: false, isWeb: false,
); );
tempFile.writeAsBytesSync(res.bodyBytes); tempFile.writeAsBytesSync(res.bodyBytes);
return tempFile.path; return XFile(tempFile.path);
} else { } else {
File? f = await asset.local!.file; File? f = await asset.local!.file;
return f!.path; return XFile(f!.path);
} }
}); });
// ignore: deprecated_member_use // ignore: deprecated_member_use
Share.shareFiles( Share.shareXFiles(
await Future.wait(downloadedFilePaths), await Future.wait(downloadedXFiles),
sharePositionOrigin: Rect.zero, sharePositionOrigin: Rect.zero,
); );
} }

View File

@ -210,7 +210,7 @@ packages:
name: cross_file name: cross_file
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.3.3+1" version: "0.3.3+2"
crypto: crypto:
dependency: transitive dependency: transitive
description: description:
@ -868,42 +868,14 @@ packages:
name: share_plus name: share_plus
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "4.0.10" version: "6.3.0"
share_plus_linux:
dependency: transitive
description:
name: share_plus_linux
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
share_plus_macos:
dependency: transitive
description:
name: share_plus_macos
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
share_plus_platform_interface: share_plus_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: share_plus_platform_interface name: share_plus_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.0.3" version: "3.2.0"
share_plus_web:
dependency: transitive
description:
name: share_plus_web
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
share_plus_windows:
dependency: transitive
description:
name: share_plus_windows
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
shared_preferences: shared_preferences:
dependency: transitive dependency: transitive
description: description:
@ -1174,14 +1146,14 @@ packages:
name: url_launcher_platform_interface name: url_launcher_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.5" version: "2.1.1"
url_launcher_web: url_launcher_web:
dependency: transitive dependency: transitive
description: description:
name: url_launcher_web name: url_launcher_web
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.11" version: "2.0.14"
url_launcher_windows: url_launcher_windows:
dependency: transitive dependency: transitive
description: description:
@ -1279,7 +1251,7 @@ packages:
name: wakelock_windows name: wakelock_windows
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.2.0" version: "0.2.1"
watcher: watcher:
dependency: transitive dependency: transitive
description: description:
@ -1307,7 +1279,7 @@ packages:
name: win32 name: win32
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.7.0" version: "3.1.3"
wkt_parser: wkt_parser:
dependency: transitive dependency: transitive
description: description:

View File

@ -32,7 +32,7 @@ dependencies:
http: 0.13.4 http: 0.13.4
cancellation_token_http: ^1.1.0 cancellation_token_http: ^1.1.0
easy_localization: ^3.0.1 easy_localization: ^3.0.1
share_plus: ^4.0.10 share_plus: ^6.3.0
flutter_displaymode: ^0.4.0 flutter_displaymode: ^0.4.0
scrollable_positioned_list: ^0.3.4 scrollable_positioned_list: ^0.3.4
path: ^1.8.1 path: ^1.8.1