分布式计数器的 firebase 扩展可以直接安装在云中并且工作得很好。要为应用程序开发新功能,我需要在模拟器上执行此操作,以免中断正在运行的服务器。
由于 firebase 扩展只是云函数*,我考虑通过从扩展本身获取源代码来在我的模拟器中实现云函数。到目前为止,这对于其他扩展来说效果很好......
在实现 javaScript 版本时,我收到以下错误:
function ignored because the unknown emulator does not exist or is not running.
这个问题可以通过重写函数的导出行来解决index.js,但无论如何都不会提供扩展的预期功能:
exports.worker = functions.handler.firestore.document.onWrite(async (change, context) => {...});
Run Code Online (Sandbox Code Playgroud)
到
exports.worker = functions.firestore.document("").onWrite(async (change, context) => {...});
Run Code Online (Sandbox Code Playgroud)
我是否缺少一些实现或缺少模拟器?我如何实现这个 firestore 扩展?
还有一些类似的问题,但并没有真正谈论整个扩展的实现:
firebase firebase-tools google-cloud-functions google-cloud-firestore
我一直在尝试重新创建它(在页面底部),但使用 flutter 版本 2.12.0 和包 photo_manager。我尝试自动执行此操作,但不幸的是,我无法将以下部分解析为较新的 dart 语法。
builder: (BuildContext context, snapshot) {
if (snapshot.connectionState == ConnectionState.done)
return Stack(
children: <Widget>[
Positioned.fill(
child: Image.memory(
snapshot.data, //wrong data type here
fit: BoxFit.cover,
),
),Run Code Online (Sandbox Code Playgroud)
在原始编写的代码(2.7)中,它工作得很好。