promptForFirebaseConfig static method
Prompts the user for Firebase configuration. Reused by InitWizard to avoid duplicating the strategy/project-ID prompt logic.
Implementation
static FirebaseConfig promptForFirebaseConfig(
AppLogger log,
FlavorConfig config,
) {
final useSuffix = config.useSuffix;
final List<String> strategyChoices;
if (useSuffix) {
strategyChoices = ['unique_id_multi_project', 'unique_id_single_project'];
} else {
strategyChoices = ['shared_id_single_project'];
}
final selectedStrategy = strategyChoices.length > 1
? log.chooseOne(
'đ Which Firebase strategy do you prefer?',
choices: strategyChoices,
)
: strategyChoices.first;
if (strategyChoices.length == 1) {
log.info(
'âšī¸ Using Firebase strategy: $selectedStrategy (matches your "Shared ID" strategy)',
);
}
final projects = <String, String>{};
if (selectedStrategy == 'unique_id_multi_project') {
for (final flavor in config.flavors) {
final projectId = log.prompt(
'đ Enter Firebase Project ID for flavor "$flavor":',
);
projects[flavor] = projectId;
}
} else {
final projectId = log.prompt('đ Enter your Firebase Project ID:');
projects['all'] = projectId;
}
return FirebaseConfig(strategy: selectedStrategy, projects: projects);
}