handleDeployHosting function
Deploy to Firebase Hosting (release)
Implementation
Future<void> handleDeployHosting() async {
final config = await ProjectConfigLoader.load();
if (config == null) {
ProjectConfigLoader.printMissingConfigHelp();
return;
}
if (!config.useFirebase) {
_printFirebaseDisabledHelp(config);
return;
}
if (!SetupGuidance.supportsWebHosting(config)) {
error('This project is not configured for web hosting.');
print('');
UserPrompt.printList(<String>[
'To add web support:',
' cd ${SetupGuidance.mainProjectPath(config)}',
' flutter create --platforms=web .',
'Then retry: oracular deploy hosting',
SetupGuidance.linkLine(
'Flutter web deployment docs',
'https://docs.flutter.dev/deployment/web',
),
]);
return;
}
final firebase = FirebaseService(config);
// Build first
if (!await firebase.buildWeb()) {
error('Web build failed');
return;
}
if (await firebase.deployHostingRelease()) {
success('Hosting deployed successfully');
SetupGuidance.printHostingSuccess(config, beta: false);
} else {
error('Hosting deployment failed');
}
}