Operation.fromJson constructor
Operation.fromJson(
- Map<String, dynamic> json
)
Implementation
factory Operation.fromJson(Map<String, dynamic> json) {
final kindName = json['kind'] as String;
final kind = OperationKind.values.firstWhere(
(e) => e.name == kindName,
orElse: () => OperationKind.createFile,
);
final ownershipClassName = json['ownershipClass'] as String;
final ownershipClass = OwnershipClass.values.firstWhere(
(e) => e.name == ownershipClassName,
);
return Operation(
kind: kind,
logicalPath: json['logicalPath'] as String,
contentHash: json['contentHash'] as String,
ownershipClass: ownershipClass,
idempotencyKey: json['idempotencyKey'] as String,
);
}