我仍然在学习flutter,并且在我的项目中遇到了一些问题,比如标题中提到的错误。我想上传文件在颤动使用dio和formData。img[]是mongodb中数据库中的变量,每当用户传递空图像时,我都会遇到错误。(因为我们不要求用户发送图像。) for (int i = 0; i < _babyList.length; i++) {
var fileName = babyList[i].pat
( 5144): [ERROR:flutter/lib/ui/ui_dart_state.cc(166)] Unhandled Exception: NoSuchMethodError: The getter'text' was called on null.E/flutter ( 5144): Receiver: null
E/flutter ( 5144): Tried calling: text
我正在尝试从JSON rest API in Flutter获取平均评级列表。当所有产品都有评分值时,列表视图显示正常,但当任何产品的评分为空时,列表视图返回错误"NoSuchMethodError: getter ' length‘is null on null。Receiver: null。已尝试调用:length。以下是我的代码; ListView.separated(