Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

The parameter 'chatmessage' can't have a value of 'null' because of its type, but the implicit default value is 'null'

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!),
  ),
),

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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!),
  ),
),
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading