I'm learning Flutter myself and need some expert guidance on the right way to do what I want.

I would like to allow the user of my Flutter application to securely send some sensitive data (e.g. email, phone number, name etc.) to my PHP based website (with REST API) and then, after some time, I would like to send a reply (e.g. . text) from my website to the sender's device and displaying it on the User's screen.

I suspect I should use Firebase Cloud Messaging for this - am I right?

I found tutorials that explain how to send data from Flutter-> FCM and from PHP(curl)-> FCM. But I can't find the tutorial explaining how to send data from Flutter-> FCM-> PHP?


Solution 1: Frank van Puffelen

Firebase Cloud Messaging is typically used to send messages from the server to the application, when the user may not be actively using it. While it can be used to send messages from the client to a server, it is much less common for that.

That's because calling a PHP API from your Flutter app is no different than retrieving any data from the internet, and can be accomplished in a multitude of ways. One of the simpler approaches is documented in Flutter's fetching data from the internet page and uses the http package.