updateHeader function

dynamic updateHeader(
  1. dynamic client,
  2. {String? languageCode,
  3. String? location}
)

Updates Http Request with the following IDs

  • device-session-id
  • location
  • accept-language
  • installation-id

Implementation

updateHeader(client, {String? languageCode, String? location}) {
  client.addDefaultHeader("device-session-id", SessionId.id);

  if (location != null) {
    client.addDefaultHeader("location", location);
  }
  if (languageCode != null) {
    client.addDefaultHeader("accept-language", languageCode);
  }
  var installationId = InstallationService().installationId;
  if (installationId != null && installationId.isNotEmpty) {
    client.addDefaultHeader("installation-id", installationId);
  }
  return client;
}