英文:
The parameter 'chatmessage' can't have a value of 'null' because of its type, but the implicit default value is 'null'
问题
以下是翻译好的内容:
"chatmessage" 参数不能为 "null",因为它的类型要求,但隐式默认值为 "null"。
尝试添加一个明确的非 "null" 默认值。
我的代码如下:
messageImageBuilder: (url, [chatmessage]) => Container(
height: 200,
width: 200,
child: PhotoView(
imageProvider: NetworkImage(url!),
),
),
英文:
I am currently using the dash_chat package to implement chat functionality in my app, but facing this issue:
The parameter 'chatmessage' can't have a value of 'null' because of its type, but the implicit default value is 'null'.
Try adding an explicit non-'null' default value.
My code looks like this:
messageImageBuilder: (url, [chatmessage]) => Container(
height: 200,
width: 200,
child: PhotoView(
imageProvider: NetworkImage(url!),
),
),
答案1
得分: 1
提到参数chatmessage
,类型为ChatMessage?
。
您的代码应该像这样..
messageImageBuilder: (url, [ChatMessage? chatmessage]) => Container(
height: 200,
width: 200,
child: PhotoView(
imageProvider: NetworkImage(url!),
),
),
英文:
Mention the parameter chatmessage
with type ChatMessage?
.
Your code should be like..
messageImageBuilder: (url, [ChatMessage? chatmessage]) => Container(
height: 200,
width: 200,
child: PhotoView(
imageProvider: NetworkImage(url!),
),
),
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论