lately i always get errors like:

(The argument type 'String?' can't be assigned to the parameter type 'String') or (The argument type 'File?' can't be assigned to the parameter type 'File') and i don't know the difference between em or what to do. help me please

this error made my life much harder this days please help guys

1

There are 1 best solutions below

0
On

Since dart introduced sound null-safety a String variable can not be null, but if your variable might be null you can declare it as String?. Therefor you can not assign something that might be null(String?) to something null-safe(String). Same with File? and File.

with ? at the end of a type you indicate that it might be null.

https://dart.dev/null-safety