Price.fromJson constructor

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

Implementation

factory Price.fromJson(Map<String, dynamic> json) {
  if (json['n'] is int && json['d'] is int) {
    return new Price(json['n'], json['d']);
  } else if (json['n'] is String && json['d'] is String) {
    int pN = checkNotNull(
        int.tryParse(json['n']), "invalid price in horizon response");
    int pD = checkNotNull(
        int.tryParse(json['d']), "invalid price in horizon response");
    return new Price(pN, pD);
  }
  throw Exception("invalid price in horizon response");
}