Reputation: 151
That method in picture that makes an error, It's called from other file. About that, Flutter required a parameter 'key', so I made it. but makes an error again like below.
Error: The argument type 'Null' can't be assigned to the parameter type 'Key'.
Conclusively what's after 'key:' instead of null?
'''
SavingAccountCard(
color: Color(0xffF1A8AF), key: null,
'''
Upvotes: 1
Views: 875
Reputation: 535
Key is a unique identifier of the widget.
There are different types of keys:
You may be able to remove the required Key from your class, but if it's required and used there you can just use ValueKey('someUniqueIdByYou').
so the code would be:
SavingAccountCard(
color: Color(0xffF1A8AF),
key: ValueKey<String>('AccountCard'),
),
Upvotes: 2