getCurrentCloneConfig function
Retrieves and displays the currently active application's name and bundle ID.
This function executes dart run rename getAppName and dart run rename getBundleId
to fetch the current application name and bundle ID of the Flutter project.
It then prints these details to the console.
Throws an Exception if there's an error executing the rename commands.
Implementation
Future<void> getCurrentCloneConfig() async {
//package_rename_config:
// android:
// app_name: ChargerJO
// package_name: com.safeersoft.chargerjo
try {
final lastClientId = await getLastClientId();
final configFile = File(Constants.packageRenameConfigFileName);
if (!configFile.existsSync()) {
throw FileSystemException(
'❌ ${Constants.packageRenameConfigFileName} not found',
);
}
final content = await configFile.readAsString();
final yaml.YamlMap config = yaml.loadYaml(content);
final androidAppName =
config['package_rename_config']?['android']?['app_name'] ?? '';
final androidPackageName =
config['package_rename_config']?['android']?['package_name'] ?? '';
final iosBundleName =
config['package_rename_config']?['ios']?['bundle_name'] ?? '';
logger.i('App Name: $androidAppName');
logger.i('Android Package Name: $androidPackageName');
logger.i('iOS Bundle Name: $iosBundleName');
logger.i('Client ID: $lastClientId');
} catch (e) {
logger.e('❌ Error getting current clone config: $e');
rethrow;
}
}