Bundle.fromJson constructor

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

Parses a bundle from its JSON representation.

Implementation

factory Bundle.fromJson(Map<String, dynamic> json) => Bundle(
      id: (json['id'] as num).toInt(),
      name: json['name'] as String,
      description: json['description'] as String?,
      icon: json['icon'] as String?,
      accent: BundleAccent.fromWire((json['accent'] as String?) ?? 'orange'),
      archivedAt: (json['archived_at'] as num?)?.toInt(),
      createdVia: json['created_via'] as String?,
      createdBy: (json['created_by'] as String?) ?? '',
      createdAt: ((json['created_at'] as num?) ?? 0).toInt(),
      updatedAt: ((json['updated_at'] as num?) ?? 0).toInt(),
    );