ChunkMetadata.fromJson constructor

ChunkMetadata.fromJson(
  1. Map<String, dynamic> map
)

Deserialises from a JSON-compatible Map.

Implementation

factory ChunkMetadata.fromJson(Map<String, dynamic> map) => ChunkMetadata(
      filename: map['filename'] as String,
      chunkIndex: map['chunkIndex'] as int,
      totalChunks: map['totalChunks'] as int,
      diskIndex: map['diskIndex'] as int,
      originalSize: map['originalSize'] as int,
      totalFileSize: map['totalFileSize'] as int?,
      checksum: map['checksum'] as String,
      parityChecksum: map['parityChecksum'] as String?,
      isParityChunk: map['isParityChunk'] as bool? ?? false,
      compressed: map['compressed'] as bool? ?? false,
      encrypted: map['encrypted'] as bool? ?? false,
      raidType: map['raidType'] as String? ?? 'raid5',
      createdAt: DateTime.parse(map['createdAt'] as String),
    );