run dart script from firestore cloud functions

28 Views Asked by At

I have a flutter application thats generate a pdf with flutter pdf package.

I want to automate the process of generating the exact pdfs every "month" for example. hence, thought of using the same pdf generation function I already wrote in my app in cloud function that will be called with google tasks.

how can I define and run dart environment and script with firestore cloud functions

1

There are 1 best solutions below

2
pcba-dev On

At this date you can only run JavaScript, TypeScript or Python code on Cloud Functions. Consequently, you shall convert it to one of those languages.

You can use the Dart compile to JS compiler to convert and generate JS code from you Dart code.

dart compile js

Beware that this compiles your Dart code to deployable JavaScript, which may not always be compatible with NodeJs.