changeLinuxBundleId method

Future<File?> changeLinuxBundleId({
  1. String? bundleId,
})

Implementation

Future<File?> changeLinuxBundleId({String? bundleId}) async {
  List? contentLineByLine = await readFileAsLineByline(
    filePath: linuxCMakeListsPath,
  );
  if (checkFileExists(contentLineByLine)) {
    logger.w('''
    Linux BundleId could not be changed because,
    The related file could not be found in that path:  $linuxCMakeListsPath
    ''');
    return null;
  }
  for (var i = 0; i < contentLineByLine!.length; i++) {
    if (contentLineByLine[i].contains('set(APPLICATION_ID')) {
      contentLineByLine[i] = 'set(APPLICATION_ID \"$bundleId\")';
    }
  }
  var writtenFile = await writeFile(
    filePath: linuxCMakeListsPath,
    content: contentLineByLine.join('\n'),
  );
  logger.i('Linux BundleIdentifier changed successfully to : $bundleId');
  return writtenFile;
}