Opcjonalnie: włączone płatności w projekcie Firebase (wymagane, jeśli planujesz korzystać z renderowania po stronie serwera)
Inicjowanie Firebase
Aby rozpocząć, zainicjuj Firebase w projekcie platformy.
Użyj interfejsu wiersza poleceń Firebase w przypadku nowego projektu lub zmodyfikuj firebase.json w przypadku istniejącego projektu.
Inicjowanie nowego projektu
W interfejsie Firebase włącz podgląd platform internetowych:
firebase experiments:enable webframeworks
Uruchom polecenie inicjowania w interfejsie wiersza poleceń, a potem postępuj zgodnie z wyświetlanymi instrukcjami:
firebase init hosting
Odpowiedz „tak” na pytanie „Czy chcesz używać platformy programistycznej?” (eksperymentalna)”.
Wybierz katalog źródłowy hostingu. Może to być istniejąca aplikacja Flutter.
Jeśli pojawi się odpowiednia prośba, wybierz Flutter Web.
Inicjowanie istniejącego projektu
Zmień konfigurację hostingu w firebase.json, aby mieć opcję source zamiast opcji public. Przykład:
[null,null,["Ostatnia aktualizacja: 2025-08-31 UTC."],[],[],null,["\u003cbr /\u003e\n\nWith the Firebase framework-aware CLI, you can deploy your Flutter application\nto Firebase.\n| **Note:** Framework-aware Hosting is an early public preview. This means that the functionality might change in backward-incompatible ways. A preview release is not subject to any SLA or deprecation policy and may receive limited or no support.\n\nBefore you begin\n\nBefore you get started deploying your app to Firebase,\nreview the following requirements and options:\n\n- Firebase CLI version 12.1.0 or later. Make sure to [install the CLI](/docs/cli#install_the_firebase_cli) using your preferred method.\n- Optional: Billing enabled on your Firebase project (required if you plan to use SSR)\n\nInitialize Firebase\n\nTo get started, initialize Firebase for your framework project.\nUse the Firebase CLI for a new project, or modify `firebase.json` for an\nexisting project.\n\nInitialize a new project\n\n1. In the Firebase CLI, enable the web frameworks preview: \n\n ```\n firebase experiments:enable webframeworks\n ```\n2. Run the initialization command from the CLI and then follow the prompts:\n\n ```\n firebase init hosting\n ```\n\n \u003cbr /\u003e\n\n3. Answer yes to \"Do you want to use a web framework? (experimental)\"\n\n4. Choose your hosting source directory; this could be an existing Flutter app.\n\n5. If prompted, choose Flutter Web.\n\nInitialize an existing project\n\nChange your hosting config in `firebase.json` to have a `source` option, rather\nthan a `public` option. For example: \n\n {\n \"hosting\": {\n \"source\": \"./path-to-your-flutter-app\"\n }\n }\n\nServe static content\n\nAfter initializing Firebase, you can serve static content with the standard\ndeployment command: \n\n firebase deploy"]]