moveFileToSharedStorage method
Move the file represented by filePath
to a shared storage
destination
and potentially a directory
within that destination. If
the mimeType
is not provided we will attempt to derive it from the
filePath
extension
Returns the path to the stored file, or null if not successful
NOTE: on iOS, using destination
SharedStorage.images or
SharedStorage.video adds the photo or video file to the Photos
library. This requires the user to grant permission, and requires the
"NSPhotoLibraryAddUsageDescription" key to be set in Info.plist. The
returned value is NOT a filePath but an identifier. If the full filepath
is required, follow the moveToSharedStorage call with a call to
pathInSharedStorage, passing the identifier obtained from the call
to moveToSharedStorage as the filePath parameter. This requires the user to
grant additional permissions, and requires the "NSPhotoLibraryUsageDescription"
key to be set in Info.plist. The returned value is the actual file path
of the photo or video in the Photos Library.
Platform-dependent, not consistent across all platforms
Implementation
Future<String?> moveFileToSharedStorage(
String filePath,
SharedStorage destination, {
String directory = '',
String? mimeType,
}) async =>
_downloader.moveToSharedStorage(
filePath, destination, directory, mimeType);