saveImageWithPath method

Future<AssetEntity> saveImageWithPath(
  1. String inputFilePath, {
  2. String? title,
  3. String? desc,
  4. String? relativePath,
  5. int? orientation,
})

Implementation

Future<AssetEntity> saveImageWithPath(
  String inputFilePath, {
  String? title,
  String? desc,
  String? relativePath,
  int? orientation,
}) async {
  _throwIfOrientationInvalid(orientation);
  final File file = File(inputFilePath);
  if (!file.existsSync()) {
    throw ArgumentError('The input file $inputFilePath does not exists.');
  }
  final Map result = await _channel.invokeMethod(
    PMConstants.mSaveImageWithPath,
    <String, dynamic>{
      'path': file.absolute.path,
      'title': title,
      'desc': desc,
      'relativePath': relativePath,
      'orientation': orientation,
      ...onlyAddPermission,
    },
  );
  return ConvertUtils.convertMapToAsset(result.cast(), title: title);
}