factory Duration.fromJson(Map<String, dynamic> json) { return Duration( unit: (json['Unit'] as String?)?.toTimeUnit(), value: json['Value'] as int?, ); }