change_project_name library

Constants

packageVersion → const String
Package version. Kept in sync with pubspec.yaml (asserted by CPN-VERSION test).

Functions

createBackup(Directory projectDir) Future<String>
Creates a backup of the project's critical files.
createGitCommit(Directory dir, String message) Future<bool>
Creates a git commit with the given message.
defaultAppId(String name) String
Builds the default com.example.* application id / bundle id for name. Underscores are stripped — iOS bundle identifiers may not contain them.
findDartFiles(Directory dir) Future<List<File>>
Recursively finds all Dart files in the given dir, excluding those in 'build/' and '.dart_tool/' directories.
getOldPackageName(Directory projectDir) Future<String?>
Extracts the current Android package name from build.gradle or build.gradle.kts
isGitRepository(Directory dir) Future<bool>
Checks if the directory is a git repository.
isValidPackageName(String name) bool
Validates a Dart package name according to Dart package naming conventions.
normalizeName(String name) String
Normalizes a string into a valid Dart package name (lowercase, underscores).
restoreBackup(Directory projectDir, String backupName) Future<void>
Restores a project from a backup dir created by createBackup. android/ and ios/ were full copies, so their live trees are replaced wholesale; lib/ backups hold .dart files only (rename never adds/removes them), so each is copied back over its original.
runCommand(List<String> args) Future<int>
runPubGet() Future<void>
updateAndroidAppName(Directory projectDir, String appName) Future<void>
Updates the Android app display name in AndroidManifest.xml
updateAndroidPackageName(Directory projectDir, String oldPackageName, String newPackageName) Future<void>
Updates the Android package name in all relevant files and renames the directory structure.
updateIOSAppName(Directory projectDir, String appName) Future<void>
Updates the iOS app display name in Info.plist
updateIOSBundleId(Directory projectDir, String bundleId) Future<void>
Updates the iOS bundle identifier in project.pbxproj
updatePackageConfig(Directory projectDir, String oldName, String newName, {bool refresh = true}) Future<void>
Updates the '.dart_tool/package_config.json' file.