簡體   English   中英

我正在嘗試從 API 中獲取 TimeZones,但由於某種原因,它沒有返回所有 timeZones

[英]I am trying to get TimeZones from an API in flutter but due to some reason its not returning all timeZones

我是顫振框架的新手。 我正在嘗試從 API 中獲取 TimeZones,但由於某種原因,它並沒有返回所有 timeZones。 我試圖獲得響應的 URL 是: https<\/a> :\/\/www.timeapi.io\/api\/TimeZone\/AvailableTimeZones

這是我的代碼:<\/strong>

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');
    }
  }

每個 ide 都有一個最大控制台日志限制,您可以更改這些限制。

如果您使用 IntelliJ 或 Android Studio IDE,請點擊以下鏈接; https:\/\/stackoverflow.com\/a\/66744625\/13109852<\/a>

或使用 VSCode 遵循以下鏈接; https:\/\/stackoverflow.com\/a\/63013785\/13109852<\/a>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM