updateFile method

void updateFile(
  1. Image image, {
  2. String? location,
  3. String? name,
  4. String prefix = '',
})

Write to a file based on the provided image, optionally overriding this.location with location and this.name with either prefix + this.name or prefix + name.

Implementation

void updateFile(Image image,
    {String? location, String? name, String prefix = ''}) {
  final Image newLauncher = createFrom(image);
  location = location ?? this.location;
  name = name ?? this.name;

  File(location + prefix + name).create(recursive: true).then((File file) {
    file.writeAsBytesSync(encodePng(newLauncher));
  });
}