我已通过以下this链接将firebase配置为在本地运行以使用仿真器进行调试。
现在,我也希望能够运行连接到本地主机的应用程序以调试触发器。是否可以通过配置flutter应用程序以使用localhost来实现此目的?
我的模拟器正在如下运行:
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());
}
注意:这仅适用于仿真器,不适用于物理设备。