Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/firebase/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
颤振:尝试从Firebase emulator读取Firestore数据,但仍从Firebase控制台读取_Firebase_Flutter_Google Cloud Firestore_Firebase Cli - Fatal编程技术网

颤振:尝试从Firebase emulator读取Firestore数据,但仍从Firebase控制台读取

颤振:尝试从Firebase emulator读取Firestore数据,但仍从Firebase控制台读取,firebase,flutter,google-cloud-firestore,firebase-cli,Firebase,Flutter,Google Cloud Firestore,Firebase Cli,我通过导入我的集合来运行Firebase emulator: firebase emulators:start --import prod-data 但是,我收到的数据来自Firebase控制台,而不是模拟器。在发出请求之前,我在设置中更改了主机 FirebaseFirestore.instance.settings = Settings( host: "http://127.0.0.1:8080", sslEnabled: false,

我通过导入我的集合来运行Firebase emulator:

firebase emulators:start --import prod-data
但是,我收到的数据来自Firebase控制台,而不是模拟器。在发出请求之前,我在设置中更改了主机

FirebaseFirestore.instance.settings = Settings(
      host: "http://127.0.0.1:8080",
      sslEnabled: false,
      persistenceEnabled: false,
    );

    try {
      List<Product> products = List<Product>();
      QuerySnapshot document = await FirebaseFirestore.instance
          .collection(FirebaseStructure.productsCollection)
          .get();
      products = document.docs
          .map((doc) => Product.fromJson(doc.data(), doc.id))
          .toList();
      return products;
    } catch (e) {
      throw Exception();
    }
FirebaseFirestore.instance.settings=设置(
主机:“http://127.0.0.1:8080",
sslEnabled:错误,
persistenceEnabled:false,
);
试一试{
列表产品=列表();
QuerySnapshot document=等待FirebaseFirestore.instance
.collection(FirebaseStructure.productsCollection)
.get();
产品=document.docs
.map((doc)=>Product.fromJson(doc.data(),doc.id))
.toList();
退货产品;
}捕获(e){
抛出异常();
}
为什么我的请求被发送到Firebase控制台而不是通过模拟器?
感谢您的帮助。

颤振应用程序在同一台计算机上的何处运行,还是移动颤振应用程序?如果是github问题,那么它是一个可能的解决方案。