createNewColorsFile function

Future<void> createNewColorsFile(
  1. String backgroundColor,
  2. String? flavor, {
  3. String prefixPath = '.',
})

Creates a colors.xml file if it was missing from android/app/src/main/res/values/colors.xml

Implementation

Future<void> createNewColorsFile(
  String backgroundColor,
  String? flavor, {
  String prefixPath = '.',
}) async {
  final colorsFile = await File(
    path.join(prefixPath, constants.androidColorsFile(flavor)),
  ).create(recursive: true);
  await colorsFile.writeAsString(xml_template.colorsXml);
  await updateColorsFile(colorsFile, backgroundColor);
}