Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
533 views
in Technique[技术] by (71.8m points)

flutter - How to execute Add 2 home from dart?

I have created an app on all 3 platforms: iOS, Android and Web. I also have manifest.json and other things required for PWA. I have deployed it to firebase hosting. Now what I want to do is manually trigger the Add to Home screen on tap of a button. The real problem is though all the articles shows code to be paste on JS side while I have all the UI in dart so How do I listen for beforeinstallprompt and trigger add to home screen manually ? I'm struggling with this from last 3 days but no luck. I have this package installed universal_html: ^1.2.3. If anyone knows how to do this please help me out.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

What about writing those code in normal JavaScript, and then call it from Dart(flutter web).

There are many resources about that. For example, Flutter Web : How to run javascript using dart js

In addition, do not forget that, when you are writing Flutter web, you have the full control over the HTML/JS/CSS/Dart. Thus nothing can stop you from writing JS code :)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...