saveImage static method

Future<bool> saveImage(
  1. File file,
  2. String albumName, {
  3. String? waterMark,
  4. Alignment? alignment,
  5. double? scale,
})

Save image to album

  • parameters:
    • file: file of video
    • albumName: save the album name
    • waterMark:assetName "images/water_mark.png"
    • alignment: 0,0represents the center of the rectangle. from -1.0 to +1.0 is the distance from one side of the rectangle to the other side of the rectangle. Default value 1,1 repesent right bottom
    • scale: the scale ratio with respect water image size.Default value is 1.0 Returns whether save success

Implementation

static Future<bool> saveImage(File file, String albumName,
    {String? waterMark, Alignment? alignment, double? scale}) async {
  Map<String, dynamic> para = {"filePath": file.path, "albumName": albumName};
  if (waterMark != null) {
    para.addAll({"waterMark": waterMark});
    if (alignment != null) {
      para.addAll({
        "alignment": {"x": alignment.x, "y": alignment.y}
      });
    } else {
      para.addAll({
        "alignment": {"x": 1, "y": 1}
      });
    }
    if (scale != null) {
      para.addAll({"scale": scale});
    } else {
      para.addAll({"scale": 1.0});
    }
  }
  final bool result = await _channel.invokeMethod('saveImage', para);
  return result;
}