[📚] Firebase performance for flutter web
Howdy, this is a bit of a followup for this issue https://github.com/firebase/flutterfire/issues/10960. I'm confused whether firebase performance is available for flutter web or not. https://pub.dev/packages/firebase_performance package has web tag in it, there is also https://pub.dev/packages/firebase_performance_web package which sounds like something that should add performance functionality to flutter web, but to no avail.
I wasn't able to find clear answer whether flutter web is supported or not. Rest of firebase functionalities for web work but for performance I get this:
Am I just blind and it's somewhere explained or are the docs missing this information.
Thanks!
Hi @Vinsho, Flutter Web does support firebase_performance. Have you tried interacting with your app after adding firebase_performance? Your Performance Dashboard should show data afterwards.
Thanks for the reply! @SelaseKay
I have, it's been in a production for quite a while now.
We get performance data for android and iOS but just web is missing. Meanwhile we also get analytics data from web so that makes me believe we have firebase setup correctly. Just to be sure:
- Is
firebase_performanceenough or do I needfirebase_performance_web? - Is there by any chance something special I need to do to enable performance for web ? As I mentioned above I believe we have firebase for web setup correctly.
Thanks a lot!
Hi @Vinsho, adding only firebase_performance should be sufficient. To the best of my knowledge, no additional setup is required for it to work on the web. I tested it with the current firebase_performance example app, and it worked fine. Feel free to check the example app to ensure you're not overlooking anything.
Thanks for the example app tip, I'm blind that I didn't find it! So I've managed to do it by actually adding some trace inside the app, f.e.:
final performance = FirebasePerformance.instance;
performance.newTrace('app_init');
After adding this and running app, I also get all the other stuff logged that I wanted, like network requests, custom traces, page load...
Way I understood it was that all this stuff would be logged automatically if performance is added to the app. But it seems like it's logged only if some newTrace is actually created within the app. Not sure if that is desired or I just understood it incorrectly :D
Anyway, thanks a lot for the help! @SelaseKay