【发布时间】:2020-01-15 04:05:56
【问题描述】:
我目前正在尝试编写一个单元测试来验证是否存在一定数量的文档。
这是我目前所拥有的
test('Login with no account', () async {
Firestore _firestore = Firestore.instance;
final QuerySnapshot result = await _firestore
.collection(UserFirestoreField.Collection)
.where(UserFirestoreField.EmailAddress, isEqualTo: 'email@example.com')
.where(UserFirestoreField.Password, isEqualTo: 'wrongpassword')
.getDocuments();
final List<DocumentSnapshot> docs = result.documents;
print(docs);
});
我得到的错误是
package:flutter/src/services/platform_channel.dart 314:7 MethodChannel.invokeMethod
MissingPluginException(没有找到方法的实现 Query#getDocuments on channel plugins.flutter.io/cloud_firestore)
我的 android 模拟器在我的应用程序启动时运行。
我看到的每个指南都在谈论模拟数据库,我想实际检查真实的数据库。
在 dart/flutter 中有什么方法可以做到这一点?
谢谢!
【问题讨论】:
标签: unit-testing dart google-cloud-platform google-cloud-firestore