/// Country entry from the Radio Browser `/json/countries` endpoint. /// /// `stationcount` arrives as a JSON **string**, not a number — an `as int` /// cast throws at runtime. This model always goes through `int.tryParse` /// and defaults safely when a field is missing or malformed (Engram /// `reference/radio-browser-countries-endpoint`, id 2500). class PaisRadio { const PaisRadio({ required this.nombre, required this.codigoIso, required this.numeroEmisoras, }); /// `name` — country name as the API returns it (not translated). final String nombre; /// `iso_3166_1` — ISO 3166-1 alpha-2, normalized to uppercase. final String codigoIso; /// `stationcount`, parsed from its JSON string form. final int numeroEmisoras; factory PaisRadio.fromApi(Map json) => PaisRadio( nombre: json['name'] as String? ?? '', codigoIso: (json['iso_3166_1'] as String? ?? '').toUpperCase(), numeroEmisoras: int.tryParse('${json['stationcount'] ?? ''}') ?? 0, ); }