validateBundleId function
Validates a bundle identifier (app ID) format.
The ID must start with a lowercase letter, followed by lowercase letters, digits, or underscores, and contain at least one dot-separated segment.
id - The bundle ID to validate.
Throws an exception if the ID is invalid.
Implementation
void validateBundleId(String id) {
final regex = RegExp(
r'^[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)+$',
);
if (!regex.hasMatch(id)) {
throw Exception('Invalid app identifier: $id');
}
}