flutterdartcommunication

Communication between two apps


At the moment I am planning on using flutter and dart to create some apps to run on windows/linux/web. Both apps will be running on the same pc.

I want to create two different apps. One will be the ForegroundApp containing a UI. The other will be a BackgroundApp which will be a background service without UI. I want to be able to communicate between these two apps by passing different type of data like maps, strings and integers.

Optionally, I would like to run the ForegroundApp on a second pc and connect trhough a local network to the BackgroundApp on the first pc. Thus the BackgroundApp must be able to connect to the ForegroundApp multiple times.

I have no idea what to look into on how to program this. Can anyone point me into the best possible direction? This must be without the use of internet or databases.

I tried googling on how to do this, the only thing I found is a suggestion on using http.


Solution

  • I've been investigating a very similar architecture lately and am leaning toward using gRPC (https://pub.dev/packages/grpc) to handle the communication between the two. So far, I'm really happy with the implementation and it can work between two apps on the same PC or between two PCs as well. Might be worth checking out.