process method

Future<void> process()

Implementation

Future<void> process() async {
  if (!await File(PATH_BUILD_GRADLE).exists()) {
    print(
        'ERROR:: build.gradle file not found, Check if you have a correct android directory present in your project'
        '\n\nrun " flutter create . " to regenerate missing files.');
    return;
  }
  String? contents = await readFileAsString(PATH_BUILD_GRADLE);

  var pacakgeReg =
      RegExp('applicationId "(.*)"', caseSensitive: true, multiLine: false);

  var packageName = pacakgeReg.firstMatch(contents!)!.group(1);
  oldPackageName = packageName;

  print("Old Package Name: $oldPackageName");

  print('Updating build.gradle File');
  await _replace(PATH_BUILD_GRADLE);

  print('Updating Main Manifest file');
  await _replace(PATH_MANIFEST);

  print('Updating Debug Manifest file');
  await _replace(PATH_MANIFEST_DEBUG);

  print('Updating Profile Manifest file');
  await _replace(PATH_MANIFEST_PROFILE);

  await updateMainActivity();
}