从 firestore 云函数运行 dart 脚本

问题描述 投票:0回答:1

我有一个 flutter 应用程序,可以使用 flutter pdf 包生成 pdf。

例如,我想自动化每个“月”生成exact pdf 的过程。因此,考虑使用我已经在云函数中的应用程序中编写的相同的 pdf 生成函数,该函数将通过 google 任务调用。

如何使用 firestore 云函数定义和运行 dart 环境和脚本

flutter dart google-cloud-firestore google-cloud-functions
1个回答
0
投票

目前,您只能运行要在 Cloud Functions 上运行的 JavaScript、TypeScript 或 Python 代码。因此,您应将其转换为其中一种语言。

您可以使用Dart 编译为 JS 编译器从 Dart 代码转换并生成 JS 代码。

dart compile js

请注意,这会将您的 Dart 代码编译为可部署的 JavaScript,这可能并不总是与 NodeJs 兼容。

© www.soinside.com 2019 - 2024. All rights reserved.