headers static method

Map<String, String> headers({
  1. Map<String, String>? extra,
})

Implementation

static Map<String, String> headers({Map<String, String>? extra}) {
  var map = <String, String>{};
  map['content-type'] = 'application/json';
  map['Accept'] = 'application/json';
  if (kIsWeb) {
    map['app-versionName'] = '1.0.0';
    map['app-version'] = '1';
  } else if (Platform.isIOS || Platform.isAndroid) {
    map['app-versionName'] = sl<PackageInfo>().version;
    map['app-version'] = sl<PackageInfo>().buildNumber;
  }
  if (extraHeaders != null) {
    map.addAll(extraHeaders!());
  }
  if (extra != null) {
    map.addAll(extra);
  }
  return map;
}