// To parse this JSON data, do // // final currencyResponse = currencyResponseFromJson(jsonString); import 'dart:convert'; CurrencyResponse currencyResponseFromJson(String str) => CurrencyResponse.fromJson(json.decode(str)); String currencyResponseToJson(CurrencyResponse data) => json.encode(data.toJson()); class CurrencyResponse { List data; CurrencyResponse({ required this.data, }); factory CurrencyResponse.fromJson(Map json) => CurrencyResponse( data: List.from(json["data"].map((x) => CurrencyInfo.fromJson(x))), ); Map toJson() => { "data": List.from(data.map((x) => x.toJson())), }; } class CurrencyInfo { String code; String name; String symbol; var rate; var alignment; bool isDefault; CurrencyInfo({ required this.code, required this.name, required this.symbol, required this.rate, required this.alignment, required this.isDefault, }); factory CurrencyInfo.fromJson(Map json) => CurrencyInfo( code: json["code"], name: json["name"], symbol: json["symbol"], alignment: json["alignment"], rate: json["rate"], isDefault: json["is_default"], ); Map toJson() => { "code": code, "name": name, "symbol": symbol, "rate": rate, "alignment": alignment, "is_default": isDefault, }; }