saveFile method

  1. @override
Future<Map<String, dynamic>> saveFile(
  1. String file, {
  2. String? name,
  3. bool isReturnPathOfIOS = false,
  4. bool skipIfExists = false,
  5. String? androidRelativePath,
})
override

Save file to gallery

file Path to the file to save name Optional custom filename isReturnPathOfIOS Whether to return the file path on iOS skipIfExists Skip saving if file with same name exists androidRelativePath Custom subfolder path for Android

Implementation

@override
Future<Map<String, dynamic>> saveFile(
  String file, {
  String? name,
  bool isReturnPathOfIOS = false,
  bool skipIfExists = false,
  String? androidRelativePath,
}) async {
  final result = await methodChannel.invokeMethod('saveFileToGallery', {
    'file': file,
    'name': name,
    'isReturnPathOfIOS': isReturnPathOfIOS,
    'skipIfExists': skipIfExists,
    'androidRelativePath': androidRelativePath,
  });
  return Map<String, dynamic>.from(result ??
      {
        'isSuccess': false,
        'errorMessage': 'Unknown error occurred',
      });
}