Flutter- Country Info using API

There are many country in the world, Here we will try to display all country info using API with Flutter. API calling is very useful tool for all Mobile applications.

You can Download Source Code via Github.

API call

 List<CountryResponse> _postList =new List<CountryResponse>();
  Future<List<CountryResponse>> countryList() async {
    String url = "all";

    http.Response response = await http.get(
      _endpoint + url,
    if (response.statusCode == 200) {
      // If the call to the server was successful, parse the JSON
      List<dynamic> values = new List<dynamic>();
      values = json.decode(response.body);
      if (values.length > 0) {
        for (int i = 0; i < values.length; i++) {
          if (values[i] != null) {
            Map<String, dynamic> map = values[i];
            _postList .add(CountryResponse.fromMap(map));
      return _postList;

List tiles Widgets

 Widget listTile(CountryResponse chatData, int index, int length) {
      return Container(
        padding: EdgeInsets.all(5),
        child: Row(
          children: [
              margin: EdgeInsets.only(right: 16),
              height: 48,
              width: 48,
              decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(10),
                  image: DecorationImage(
                      image: chatData.name != null && chatData.flag.isNotEmpty
                          ? NetworkImage('https://flagcdn.com/w320/' +
                              chatData.alpha2Code.toLowerCase() +
                          : AssetImage(ImageUtils.noProfileImage),
                      fit: BoxFit.cover)),
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                    style: chatNameStyle,
                    style: chatEmailStyle,

You can Download Source Code via Github.

33 Replies to “Flutter- Country Info using API”

  1. Everything is very open with a precise clarification of the challenges.
    It was truly informative. Your site is very useful.
    Thanks for sharing!

  2. I am not sure where you’re getting your info, but great topic.
    I needs to spend some time learning more or understanding more.
    Thanks for wonderful information I was looking for this info for my mission.

  3. Hi my family member! I want to say that this post is awesome, great written and come
    with almost all vital infos. I would like to look extra posts like this .

  4. whoah this blog is wonderful i love reading your articles.

    Stay up the great work! You understand, lots of people
    are looking round for this info, you can aid them greatly.

  5. Hello! Quick question that’s totally off topic. Do you know how to make your site mobile friendly?
    My site looks weird when viewing from my iphone 4. I’m
    trying to find a theme or plugin that might be
    able to resolve this problem. If you have any recommendations, please share.
    Appreciate it!

  6. Everything is very open with a really
    clear explanation of the challenges.
    It was definitely informative.
    Your site is very useful.
    Many thanks for sharing!

  7. Tremendous things here. I’m very satisfied to peer your article.
    Thanks a lot and I’m having a look ahead to contact you. Will you please drop me a mail?

  8. It’s remarkable to visit this site and reading the views of all mates concerning
    this piece of writing, while I am also keen of getting know-how.

  9. Greate post. Keep writing such kind of information on your page.
    Im really impressed by your site.
    Hey there, You’ve done an incredible job. I’ll definitely digg it and in my view recommend
    to my friends. I’m confident they’ll be benefited from
    this site.

  10. Good day! I just want to offer you a huge thumbs up for your excellent
    info you have got right here on this post. I am coming back to your website for more soon.

  11. What’s up i am kavin, its my first time to commenting anyplace, when i read this article i thought
    i could also make comment due to this brilliant article.

Leave a Reply

Your email address will not be published.