【发布时间】:2021-09-20 02:06:03
【问题描述】:
这个条件:
@override
Widget build(context) {
return Scaffold(
appBar: buildSearchField(),
body:
searchResultsFuture == null ? buildNoCont() : buildSearchRes(),
);}}
抛出此错误:
The operand can't be null, so the condition is always false.
Try removing the condition, an enclosing condition, or the whole conditional statement.
它是这样声明的:
late Future<QuerySnapshot> searchResultsFuture;
我已经在导入 cloud_firestore 包了。
我已经尝试了所有可用的方法,但仍然出现此错误,我需要保持条件。
【问题讨论】:
-
告诉我们你在哪里更新
searchResultsFuture
标签: flutter dart google-cloud-firestore