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: (json['id'] is int
            ? json['id'] as int
            : int.tryParse(json['id']?.toString() ?? '')) ??
        0,
    isDefault: (json['is_default'] as bool?) ?? false,
    isDark: (json['is_dark'] as bool?) ?? false,
    name: (json['name'] as String?) ?? '',
    document: Document.fromJson(json['document'] as Map<String, dynamic>?),
    type: BackgroundType.fromJson(json['type'] as Map<String, dynamic>?)!,
  );
}