fromJSON static method

Price? fromJSON(
  1. Map<String, dynamic>? json
)

Creates an Price from its JSON representation. If the price can't be parsed, a warning will be logged with warnings.

Implementation

static Price? fromJSON(Map<String, dynamic>? json) {
  if (json == null) {
    return null;
  }
  String? currency = json.optNullableString("currency");
  double? value = json.optPositiveDouble("value");
  if (currency == null || value == null) {
    return null;
  }

  return Price(currency: currency, value: value);
}