In Example at https://pub.dev/packages/contacts_service/versions/0.4.3/example there is a code like as follows

itemCount: _contacts?.length ?? 0,

and I have two question on that,

what is meant by variableName? ( variableName followed by question mark '?') e.g in above _contacts?

The second question was on two question marks and is at What are the ?? double question marks in Dart?


Solution 1: Jay Kukadiya

"Variable?" is use for null safety. If _contact has value null then we can't check length of variable or it's throw error.

"??" is used for if condition. It's assign value 0.

Check Here for more information.