getExternalStoragePublicDirectory function

  1. @Deprecated('''Deprecated in API level 29 (Android 10+) and was deprecated in this package after v0.3.0.\nSee how to migrate: https://stackoverflow.com/questions/56468539/getexternalstoragepublicdirectory-deprecated-in-android-q''')
Future<Directory?> getExternalStoragePublicDirectory(
  1. EnvironmentDirectory directory
)

Equivalent to Environment.getExternalStoragePublicDirectory.

Added in API level 8.

Deprecated in API level 29.

See EnvironmentDirectory to see all available directories.

See how to migrate from this deprecated API.

Refer to details

Implementation

@Deprecated(
  '''Deprecated in API level 29 (Android 10+) and was deprecated in this package after v0.3.0.\nSee how to migrate: https://stackoverflow.com/questions/56468539/getexternalstoragepublicdirectory-deprecated-in-android-q''',
)
Future<Directory?> getExternalStoragePublicDirectory(
  EnvironmentDirectory directory,
) async {
  const kGetExternalStoragePublicDirectory =
      'getExternalStoragePublicDirectory';
  const kDirectoryArg = 'directory';

  final args = <String, String>{kDirectoryArg: '$directory'};

  final publicDir = await kEnvironmentChannel.invokeMethod<String?>(
    kGetExternalStoragePublicDirectory,
    args,
  );

  if (publicDir == null) return null;

  return Directory(publicDir);
}