commonHeaders method Null safety

Map<String, String> commonHeaders()

Implementation

Map<String, String> commonHeaders() {
  final sessionKey = state?.sessionKey;
  final commonHeaders = <String, String>{
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    if (sessionKey != null)
      'Session-Key': sessionKey
    else if (token != null)
      'Api-Token': token!
  };
  if (headers.isNotEmpty) {
    commonHeaders.addAll(headers);
  }

  return commonHeaders;
}