在GridView.count()中,在null上调用了getter'length'

时间:2020-07-17 07:28:57

标签: android flutter dart

我在Consumer()中实现了GridView.count并收到以下错误:exp

但是当我尝试打印列表长度时,它不是null。

The getter 'length' was called on null.

这是我的代码:

I/flutter ( 6581): 7

════════ Exception caught by widgets library ═══════════════════════════════════
The following NoSuchMethodError was thrown building NotificationListener<KeepAliveNotification>:
The getter 'length' was called on null.
Receiver: null
Tried calling: length

如何解决此问题?即使长度不为null。

注意:此问题是由另一个API调用引起的,该API返回null且未正确处理。

0 个答案:

没有答案