fromJson static method

Background? fromJson(
  1. Map<String, dynamic>? json
)

Implementation

static Background? fromJson(Map<String, dynamic>? json) {
  if (json == null) {
    return null;
  }

  return Background(
    id: int.tryParse((json['id'] as dynamic)?.toString() ?? '') ?? 0,
    isDefault: (json['is_default'] as bool?) ?? false,
    isDark: (json['is_dark'] as bool?) ?? false,
    name: (json['name'] as String?) ?? '',
    document: Document.fromJson(tdMapFromJson(json['document'])),
    type: BackgroundType.fromJson(tdMapFromJson(json['type'])),
  );
}