Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Cloud Run in FLutter

Hi,

I am developing an application, using Flutter, that allows a user to choose multiple files from her local file system, and upload them to Google Storage. Once the multiple uploads are complete, I would like to launch a Google run function to do some data processing. Since there are usually more than one file uploaded, setting up an event-driven launch does not seem to be the ideal approach, since the function should only be executed when the upload of all files is complete (and these files are video).

I would like to do a direct call to google run, but I am not sure how to do it from flutter. The fact that  Firestore offer functions and the duality with the google run function confuses me even further.

What would you recommend as an approach?

Thank you

Solved Solved
0 2 2,190
1 ACCEPTED SOLUTION

Hi @magenti,

Welcome to Google Cloud Community!

One approach for calling a Google Cloud Run function from your Flutter app would be to use the Cloud Functions for Firebase package. This package allows you to call Cloud Functions directly from your client-side code, which can be useful for triggering server-side processing.

Another approach would be to use the Google Cloud client libraries for the programming language that your Cloud Run function is written in to make an HTTP request to the Cloud Run endpoint from your Flutter app.

It's also important to note that Cloud Run is a fully managed compute platform that enables you to run stateless containers, while Firestore is a NoSQL document database that stores and syncs data for client- and server-side development. You can use both services together, but they serve different purposes and it's important to understand the use cases for each.

So, my recommendation would be to use the Cloud Functions for Firebase package to call the Cloud Run function from your Flutter app after all the files have been uploaded to Google Storage.

Here are some references that may help you with integrating Cloud Run with your Flutter app:

  1. Cloud Functions for Firebase documentation: https://firebase.google.com/docs/functions
  2. Cloud Functions for Firebase Flutter package:https://pub.dev/packages/cloud_functions
  3. Google Cloud Run documentation: https://cloud.google.com/run/docs
  4. Google Cloud Run quickstart for client libraries: https://cloud.google.com/run/docs/quickstarts/build-and-deploy#client-libraries
  5. Google Cloud Storage documentation: https://cloud.google.com/storage/docs
  6. Flutter packages for Google Cloud Storage: https://pub.dev/packages?q=google+cloud+storage

    Note: In order to use these resources, you must have a valid project set up on the Google Cloud Platform and you should have the required permission to access the resources.

Thank you

View solution in original post

2 REPLIES 2

Hi @magenti,

Welcome to Google Cloud Community!

One approach for calling a Google Cloud Run function from your Flutter app would be to use the Cloud Functions for Firebase package. This package allows you to call Cloud Functions directly from your client-side code, which can be useful for triggering server-side processing.

Another approach would be to use the Google Cloud client libraries for the programming language that your Cloud Run function is written in to make an HTTP request to the Cloud Run endpoint from your Flutter app.

It's also important to note that Cloud Run is a fully managed compute platform that enables you to run stateless containers, while Firestore is a NoSQL document database that stores and syncs data for client- and server-side development. You can use both services together, but they serve different purposes and it's important to understand the use cases for each.

So, my recommendation would be to use the Cloud Functions for Firebase package to call the Cloud Run function from your Flutter app after all the files have been uploaded to Google Storage.

Here are some references that may help you with integrating Cloud Run with your Flutter app:

  1. Cloud Functions for Firebase documentation: https://firebase.google.com/docs/functions
  2. Cloud Functions for Firebase Flutter package:https://pub.dev/packages/cloud_functions
  3. Google Cloud Run documentation: https://cloud.google.com/run/docs
  4. Google Cloud Run quickstart for client libraries: https://cloud.google.com/run/docs/quickstarts/build-and-deploy#client-libraries
  5. Google Cloud Storage documentation: https://cloud.google.com/storage/docs
  6. Flutter packages for Google Cloud Storage: https://pub.dev/packages?q=google+cloud+storage

    Note: In order to use these resources, you must have a valid project set up on the Google Cloud Platform and you should have the required permission to access the resources.

Thank you

Thank you Christian, 

I will go through the documentation you suggested and find the way, The high-level description of precesses and mechanisms will help me to make sense of what i will read in. the docs. Thank yoU!