androidUnzip static method

Future<bool> androidUnzip(
  1. String zipPath, [
  2. Directory? destination
])

Android content provider uri has to be copied to a local file first

Implementation

static Future<bool> androidUnzip(String zipPath,
    [Directory? destination]) async {
  final String? path;
  try {
    path = await _channel
        .invokeMethod<String>('contentUriToFile', {'uri': zipPath});
  } on PlatformException catch (e, st) {
    Logger.error(
        'Could not copy the shared content uri to a file '
        '(code: ${e.code}, uri scheme: ${Uri.tryParse(zipPath)?.scheme})',
        e.message,
        st);
    return false;
  }
  if (path == null) {
    Logger.error('contentUriToFile returned null for the shared uri');
    return false;
  }
  return await _unzip(File(path), destination);
}