AlgoScrypt.fromMap constructor

AlgoScrypt.fromMap(
  1. Map<String, dynamic> map
)

Implementation

factory AlgoScrypt.fromMap(Map<String, dynamic> map) {
  return AlgoScrypt(
    type: map['type'].toString(),
    costCpu: (map['costCpu'] is String)
        ? int.tryParse(map['costCpu']) ?? 0
        : map['costCpu'] ?? 0,
    costMemory: (map['costMemory'] is String)
        ? int.tryParse(map['costMemory']) ?? 0
        : map['costMemory'] ?? 0,
    costParallel: (map['costParallel'] is String)
        ? int.tryParse(map['costParallel']) ?? 0
        : map['costParallel'] ?? 0,
    length: (map['length'] is String)
        ? int.tryParse(map['length']) ?? 0
        : map['length'] ?? 0,
  );
}