getMediaStoreContentDirectory function

  1. @Deprecated('Android specific APIs will be removed soon in order to be replaced with a new set of original cross-platform APIs.')
Future<Uri?> getMediaStoreContentDirectory(
  1. MediaStoreCollection collection
)

The contract between the media provider and applications.

Get the directory of a given MediaStoreCollection

Refer to details

Implementation

@Deprecated(
  'Android specific APIs will be removed soon in order to be replaced with a new set of original cross-platform APIs.',
)
Future<Uri?> getMediaStoreContentDirectory(
  MediaStoreCollection collection,
) async {
  const kGetMediaStoreContentDirectory = 'getMediaStoreContentDirectory';
  const kCollectionArg = 'collection';

  final args = <String, String>{kCollectionArg: '$collection'};

  final publicDir = await kMediaStoreChannel.invokeMethod<String?>(
    kGetMediaStoreContentDirectory,
    args,
  );

  if (publicDir == null) return null;

  return Uri.parse(publicDir);
}