ExchangeRate.fromJson constructor

ExchangeRate.fromJson(
  1. Object? json
)

Implementation

factory ExchangeRate.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return ExchangeRate(
    id: (map['id'] as String),
    rates: (map['rates'] as Map).cast<String, Object?>().map((
          key,
          value,
        ) =>
            MapEntry(
              key,
              (value as num).toDouble(),
            )),
  );
}