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.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x