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 {
try {
// Run 'rename getAppName'
final ProcessResult appNameResult = await Process.run('dart', [
'run',
'rename',
'getAppName',
], runInShell: true);
// Run 'rename getBundleId'
final ProcessResult bundleIdResult = await Process.run('dart', [
'run',
'rename',
'getBundleId',
], runInShell: true);
// Check and print the results
if (appNameResult.stderr.toString().isNotEmpty) {
logger.e('❌ Error getting app name: ${appNameResult.stderr}');
} else {
logger.i('App Name:\n${appNameResult.stdout}');
}
if (bundleIdResult.stderr.toString().isNotEmpty) {
logger.e('❌ Error getting bundle ID: ${bundleIdResult.stderr}');
} else {
logger.i('Bundle ID:\n${bundleIdResult.stdout}');
}
} catch (e) {
logger.e('❌ Error getting current clone config: $e');
}
}