createBackgroundImage function

Future<void> createBackgroundImage(
  1. Image image,
  2. File imageFile
)

Implementation

Future<void> createBackgroundImage(Image image, File imageFile) async {
  const iosAssetsFolder = CmdStrings.iosBackgroundImageDirectory;
  final file = await File('$iosAssetsFolder/${IOSStrings.iosContentJson}')
      .create(recursive: true);

  final iosContent = IosContentJsonDm(
    images: [image],
    info: const Info(author: 'xcode', version: 1),
  );
  final iosContentJson = iosContent.toJson();
  encoder.convert(iosContentJson);
  file.writeAsString(encoder.convert(iosContentJson));
  final backgroundImage =
      File('$iosAssetsFolder/${IOSStrings.backgroundImageSnakeCase}.png');

  await backgroundImage.writeAsBytes(await imageFile.readAsBytes());
}