toJson method

Map<String, dynamic> toJson()

Produces a Map that can be serialized to JSON.

Implementation

Map<String, dynamic> toJson() {
  final json = <String, dynamic>{};

  String? orientation;

  switch (this.orientation) {
    case SentryOrientation.portrait:
      orientation = 'portait';
      break;
    case SentryOrientation.landscape:
      orientation = 'landscape';
      break;
    case null:
      orientation = null;
      break;
  }

  if (name != null) {
    json['name'] = name;
  }

  if (family != null) {
    json['family'] = family;
  }

  if (model != null) {
    json['model'] = model;
  }

  if (modelId != null) {
    json['model_id'] = modelId;
  }

  if (arch != null) {
    json['arch'] = arch;
  }

  if (batteryLevel != null) {
    json['battery_level'] = batteryLevel;
  }

  if (orientation != null) {
    json['orientation'] = orientation;
  }

  if (manufacturer != null) {
    json['manufacturer'] = manufacturer;
  }

  if (brand != null) {
    json['brand'] = brand;
  }

  if (screenResolution != null) {
    json['screen_resolution'] = screenResolution;
  }

  if (screenWidthPixels != null) {
    json['screen_width_pixels'] = screenWidthPixels;
  }

  if (screenHeightPixels != null) {
    json['screen_height_pixels'] = screenHeightPixels;
  }

  if (screenDensity != null) {
    json['screen_density'] = screenDensity;
  }

  if (screenDpi != null) {
    json['screen_dpi'] = screenDpi;
  }

  if (online != null) {
    json['online'] = online;
  }

  if (charging != null) {
    json['charging'] = charging;
  }

  if (lowMemory != null) {
    json['low_memory'] = lowMemory;
  }

  if (simulator != null) {
    json['simulator'] = simulator;
  }

  if (memorySize != null) {
    json['memory_size'] = memorySize;
  }

  if (freeMemory != null) {
    json['free_memory'] = freeMemory;
  }

  if (usableMemory != null) {
    json['usable_memory'] = usableMemory;
  }

  if (storageSize != null) {
    json['storage_size'] = storageSize;
  }

  if (freeStorage != null) {
    json['free_storage'] = freeStorage;
  }

  if (externalStorageSize != null) {
    json['external_storage_size'] = externalStorageSize;
  }

  if (externalFreeStorage != null) {
    json['external_free_storage'] = externalFreeStorage;
  }

  if (bootTime != null) {
    json['boot_time'] = bootTime!.toIso8601String();
  }

  if (timezone != null) {
    json['timezone'] = timezone;
  }

  if (language != null) {
    json['language'] = language;
  }

  return json;
}