How can I host my flutter web with firebase - flutter

i've try to host my flutter in firebase but it doesn't work.
I already follow the steps of the firebase web and the result is this:
1.firebase init hosting
2.firebase deploy --only hosting
The structure of my proyect is: And i want the page to go to main.dart

Open Terminal then write :
firebase init hosting
then
flutter build web
then
firebase deploy --only hosting
for more details you can read this article

It is discussed in this github thread
change your firebase.json config slightly. You currently have the
public directory set to build but if you look in there, the >index.htmlis the file you're seeing with the "Firebase Hosting Complete"
message. When you build your app, it is actually being put into
build/your-app-name so you'll need to change the line in firebase.json
from:
"public": "build",
to:
"public": "build/your-app-name",
Also check above github and these similar cases for more alternate solutions:
Flutter web app is missing firebase.json and shows "Welcome Firebase Hosting Setup Complete" when deployed to firebase hosting
Flutter web app won't deploy to Firebase hosting
Firebase deploy displays Welcome Screen with no App Content

The problem was that i have "estilos" y "responsive" in the same place as main.dart.

Related

Flutter swap current Firebase Project with another

I have a current Flutter project which is linked to a Firebase project and is reading and writing from a Realtime Database. My issue is that I have used the wrong project and now want to switch my Flutter app to use a different Project's Realtime Database. Is it possible to switch the Firebase project my app is currently linked to and if so how do I go about doing that?
Thanks
The FlutterFire CLI is a great tool for quickly configuring Firebase resources for Flutter projects and it could be used to switch the Firebase project to which the configuration files in your Flutter project are pointed.
First you could want to set up the FlutterFire CLI by following the instructions on the Firebase site:
Install the Firebase CLI.
Log into Firebase using the Google account under which you have the new Firebase project you want to switch to set up by running the following command: firebase login
Install the FlutterFire CLI by running the following command from any directory: dart pub global activate flutterfire_cli
Then, after getting the FlutterFire CLI set up, it would probably be a good idea to make sure your current Firebase configuration is backed up some how, either using version control or manually.
Finally, to switch your Flutter configuration to a different Firebase project, run flutterfire configure and follow the steps in the workflow, making sure to select the new Firebase project.

Firebase "Email link sign in" using "Custom domain" is not working. (for Flutter passwordless authentication)

Issue: When tapping on redirect link it gives Page Not Found.
What is expected: Tapping on the redirect link sent to your email should open up the app if it is installed.
Have tried the suggestions from most related solutions on StackOverflow and GitHub.
My custom domain in Hosting:
It is also authurized:
Dynamic links I made:
ActionCodeSettings URL prod project: https://myprodapp.com/login/welcome
firebase.json:
added to info.plist:
Associated domain for iOS
Callback URL:
Android
iOS
Need to mention we have two firebase projects connected to our flutter app - one for the development environment (dev) and the other for the product environment (prod). Passwordless sign in with the firebase default domain works on dev environment for only Android. So seems the coding part works fine.

How to create admob app-ads.txt file flutter web app?

I have a website made with flutter web. My app which shows google admob ad. Now google admob told me to create an app-ads.txt file on my website . Flutter web is a single page website so, is it possible to create an app-ads.txt file with my flutter web app !?
I also recently tried flutter web. I went on a "fishing expedition", and managed to solve this issue.
What i did:
Place your app-ads.txt in <project>/web folder.
Run flutter build web
Check that app-ads.txt appeared in build/web folder.
Check that in build/web/flutter_service_worker.js in RESOURCES map appeared a record with key "app-ads.txt"(ex. "app-ads.txt": "4c75380ac52243715a448e96239e0ca5",)
Run firebase deploy --only hosting
After this, app-ads.txt should be available on https://your-domain.web.app/app-ads.txt, https://your-domain.firebaseapp.com/app-ads.txt and(if you added a custom domain) on https://my-custom-domain.com/app-ads.txt.
P.S. If you got redirected from /app-ads.txt to your main page, then try to clear your site cache:
Press F12
Open "Application" tab
Choose "Storage"
Press "Clear site data"
After this, app-ads.txt should be available.

How to deploy Flutter Web to my own server?

I've just created a flutter web application and now I am ready to deploy it. Looking at the docs it looks like I need to use Firebase Hosting? But I want to host the app on my own server. I tried copying the web directory from Build but when I go to the path I get a blank screen on web. How do I deploy it correctly? Or is it just simply not possible without Firebase?
First you need to compile the application.
In a terminal, command prompt or Powershell, go to the root directory of your project.
From there run a build:
flutter build web
This will create a new directory inside your project.
c:\your-project-folder\build\web
Copy everything that is in the web folder to wherever you want to publish / host your application.
Your application is bundled up into a main.dart.js file.
An index.html is also in that directory. You should be able to run your Flutter web app by visiting that index.html.
All the instructions for building a Flutter application for web platform is here.

Changes not reflecting on flutter web deploy after firebase project owner changed

Using flutter web I created a web app that can connect to firestore and deployed using firebase hosting. Everything works fine until I change the owner from myself to another. I can still use firebase deploy using the other(2nd) account, but the changes are not reflecting when opening the app url. Is there any need for additional configuration or its a bug? Thanks for any answer
You should be able to fix by doing a hard cache reset on Chrome, by using the following key
combination: ctrl + shift + r.
Or, you can delete the build/web folder and build your project for web again.