BucketFile.fromJson constructor

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

Creates a BucketFile instance from a JSON object.

Used for deserializing file data from the Calljmp API.

Parameters

  • json: JSON object containing file data

Returns

A new BucketFile instance

Implementation

factory BucketFile.fromJson(Map<String, dynamic> json) {
  return BucketFile(
    id: json['id'] as int,
    key: json['key'] as String,
    description: json['description'] as String?,
    tags: (json['tags'] as List<dynamic>?)?.map((e) => e as String).toList(),
    bucketId: json['bucketId'] as int,
    type: json['type'] as String?,
    size: json['size'] as int,
    createdAt: DateTime.parse(json['createdAt'] as String),
  );
}