PriceRange.fromJson constructor

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

Implementation

factory PriceRange.fromJson(Map<String, dynamic> json) {
  return PriceRange(
    min: (json['min'] as num).toDouble(),
    max: (json['max'] as num).toDouble(),
    currency: json['currency'] as String? ?? 'USD', // 默认使用USD货币
    symbol: json['symbol'] as String? ?? r'$', // 默认使用$符号
  );
}