Flutter + firebase:配置应用程序以使用本地Firebase模拟器

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

我已通过以下this链接将firebase配置为在本地运行以使用仿真器进行调试。

现在,我也希望能够运行连接到本地主机的应用程序以调试触发器。是否可以通过配置flutter应用程序以使用localhost来实现此目的?

我的模拟器正在如下运行:

enter image description here

firebase flutter google-cloud-functions
1个回答
0
投票
import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:flutter/material.dart'; import 'package:tracker/screens/screens.dart'; void main() async { // This will set the app to communicate with localhost await Firestore.instance.settings(host: "10.0.2.2:8080", sslEnabled: false); runApp(AppSetupScreen()); }

注意:这仅适用于仿真器,不适用于物理设备。
© www.soinside.com 2019 - 2024. All rights reserved.