I Am Trying To Get TimeZones From An API In Flutter But Due To Some Reason Its Not Returning All TimeZones
I am new to the flutter framework. I am trying to get TimeZones from an API in flutter but due to some reason, it's not returning all timeZones. URL from which I am trying to get a response is: https://www.timeapi.io/api/TimeZone/AvailableTimeZones
Here is my code :
import 'package:http/http.dart';
import 'dart:convert';
class WorldClock {
late String location;
late String time;
late String flag;
late String url;
late bool isDayTime = false;
WorldClock({required this.location, required this.flag, required this.url});
Future<void> getLocations() async {
try {
Response response = await get(
Uri.parse('https://www.timeapi.io/api/TimeZone/AvailableTimeZones'));
print(response.body);
} catch (e) {
print('failed to load locations');
}
}
The output I am getting is :
["Africa/Abidjan","Africa/Accra","Africa/Addis_Ababa","Africa/Algiers","Africa/Asmara","Africa/Asmera","Africa/Bamako","Africa/Bangui","Africa/Banjul","Africa/Bissau","Africa/Blantyre","Africa/Brazzaville","Africa/Bujumbura","Africa/Cairo","Africa/Casablanca","Africa/Ceuta","Africa/Conakry","Africa/Dakar","Africa/Dar_es_Salaam","Africa/Djibouti","Africa/Douala","Africa/El_Aaiun","Africa/Freetown","Africa/Gaborone","Africa/Harare","Africa/Johannesburg","Africa/Juba","Africa/Kampala","Africa/Khartoum","Africa/Kigali","Africa/Kinshasa","Africa/Lagos","Africa/Libreville","Africa/Lome","Africa/Luanda","Africa/Lubumbashi","Africa/Lusaka","Africa/Malabo","Africa/Maputo","Africa/Maseru","Africa/Mbabane","Africa/Mogadishu","Africa/Monrovia","Africa/Nairobi","Africa/Ndjamena","Africa/Niamey","Africa/Nouakchott","Africa/Ouagadougou","Africa/Porto-Novo","Africa/Sao_Tome","Africa/Timbuktu","Africa/Tripoli","Africa/Tunis","Africa/Windhoek","America/Adak","America/Anchorage","America/Anguilla","America/Antigua","America/Ar
From the output, you can clearly see after Ameria/Ar, it's breaking and not storing it.
Any possible fix?
Answer
Every ide has a max console log limit, you can change these limits.
If you are using IntelliJ or Android Studio IDE follow below link; https://stackoverflow.com/a/66744625/13109852
or using VSCode follow below link; https://stackoverflow.com/a/63013785/13109852
Related Questions
- → How do you create a 12 or 24 mnemonics code for multiple cryptocurrencies (ETH, BTC and so on..)
- → Flutter: input text field don't work properly in a simple example..... where am I wrong?
- → Can I customize the code formatting of Dart code in Atom?
- → Is it possible to develop iOS apps with Flutter on a Linux virtual machine?
- → Display SnackBar in Flutter
- → JSON ObjectMapper in Flutter
- → Material flutter app source code
- → TabBarSelection No such method error
- → How do I set the animation color of a LinearProgressIndicator?
- → Add different routes/screens to Flutter app
- → Is there a way to get the size of an existing widget?
- → How to share a file using flutter
- → Is there an easy way to find particular text built from RichText in a Flutter test?