The argument type ‘Null’ can’t be assigned to the parameter type

Posted by

Error:

The argument type 'Null' can't be assigned to the parameter type 'Color'.dartargument_type_not_assignable
Type: Null

Solution:

You’re trying to send null to a parameter that expects a Colour value, which is why the problem occurs. In place of null, you can use Colors.transparent if you wish to avoid specifying a borderColor. The following is how to update your code:

AvatarImage(
  imageUrl: doctor["avatar"],
  bgColor: Colors.transparent,
  borderColor: Colors.transparent,
),

This way, you’re providing a valid Color value for the borderColor parameter.

Leave a Reply

Your email address will not be published. Required fields are marked *

0
Would love your thoughts, please comment.x
()
x