You can connect them by making a Flask API, deploying it on a server , and then interacting with that API from your Flutter app using any kind of request package, and this will indeed be the same code for both platforms.
Read moreHow do I connect Python backend to Flutter?
Here are the steps you should follow:
Read more