تسجيل جديد

تسجيل دخول

نسيت كلمة المرور

هل نسيت كلمة المرور؟ الرجاء إدخال بريدك الإلكتروني، وسوف تصلك رسالة عليه حتى تستطيع عمل كلمة مرور جديدة.

برجاء إدخال الاسم.

برجاء إدخال البريد الإلكتروني.

يرجى اختيار عنوان مناسب للسؤال حتى يمكن الإجابة عليه بسهولة.
يرجى اختيار القسم المناسب بحيث يمكن البحث في السؤال بسهولة.

يرجى اختيار الوسوم المناسبة، مثل: سؤال، تصويت.

اكتب الوصف تمامًا وبالتفاصيل.

يجب تسجيل الدخول لتستطيع إضافة مقالة.

برجاء توضيح أسباب شعورك أنك بحاجة للإبلاغ عن السؤال.

برجاء توضيح أسباب شعورك أنك بحاجة للإبلاغ عن الإجابة.

برجاء توضيح أسباب شعورك أنك بحاجة للإبلاغ عن المستخدم.

Flutter Tutorial for Beginners #27 – World Time API

Flutter Tutorial for Beginners #27 – World Time API



Hey ninjas, in this Flutter tutorial we’ll take a look at the API we’ll be using to get our time data – the World Time API.
—————————————-

🐱‍💻 🐱‍💻 Course Links:

Course files – https://github.com/iamshaunjp/flutter-beginners-tutorial
Android Studio – https://developer.android.com/studio
Git – https://git-scm.com/downloads
Flutter Installation – https://flutter.dev/docs/get-started/install

🐱‍💻 🐱‍💻 Other Related Courses:

+ Modern JavaScript Tutorial – https://www.udemy.com/modern-javascript-from-novice-to-ninja/?couponCode=NINJAYT

source

آخر المقالات

CD9 Aventuras Con Office Depot 4

‫اضف تعليق

‫32 تعليق

  1. Try this:
    String dateTime = data['datetime'].substring(0, 23); // returns 2021-10-07T00:27:39.270

    When playing around with this I noticed that the datetime adds the offset to the end:
    datetime: 2021-10-07T00:27:39.270356 (-05:00) <——– //parentheses added to show offset

    it will return the correct time without the need to deal with the offset.

    If you want to use offset you can account for the sign like this:

    if (data['utc_offset'].substring(0, 1) == '-') {

    now = now.subtract(Duration(hours: int.parse(offset)));

    //print(data['utc_offset'].substring(0, 1));

    } else {

    now = now.add(Duration(hours: int.parse(offset)));

    //print(data['utc_offset'].substring(0, 1));

    }

  2. If you want UTC negative offsets get the whole string included inthe + – signs when parsing offset

    String datetime = data['datetime'];

    int offset = int.parse(data['utc_offset'].substring(0, 3));

    DateTime now = DateTime.parse(datetime);

    now = now.add(Duration(hours: offset));

    print(now);

    }

  3. Please am getting error while trying to get the the informations from the world time api

    Error:

    Unhandled exception: HandshakeException: Handshake error in client (os Error: CERTIFICATE_VERIFY_FAILDED: certificate has expired(handshake.cc.359))

    And so on…..

    Please i will appreciate if you or anyone can help me i am using the latest version of flutter and dart and also android studio

  4. One thing to remember is that the offset can be either positive or negative.
    So, its better to define 2 offsets, one for hours and another for minutes….like this :

    String offset1 = data['utc_offset'].substring(1, 3); //for Hour

    String offset2 = data['utc_offset'].substring(4, 6); //for Minutes

    Also, to find whether to add or subtract this(cause of the – or + sign in offset) :

    String addOrSub = data['utc_offset'].substring(0, 1); //to find sign(+/-)

    And finally, a simple if-else statement to print the correct time :

    if (addOrSub == '+') {

    DateTime now = DateTime.parse(datetime);

    now = now.add(

    Duration(hours: int.parse(offset1), minutes: int.parse(offset2)));

    print(now);

    } else {

    DateTime now = DateTime.parse(datetime);

    now = now.subtract(

    Duration(hours: int.parse(offset1), minutes: int.parse(offset2)));

    print(now);

    }

  5. So where's the WorldTimeApi homepage link? I've already googled it and the page view is quite different with this video's..

  6. Well, I've arrived here but it's all been a waste of time. The worldtimeapi isn't available.

    Or rather, it's there but there is no accessible list of places.

    anyone know of an alternative?

  7. I know i'm probably just one more random comment here, but I, such as hundreds of people that were following the incredible tutorial that this has been, have not been able to proceed with it. as we're getting errors related to the API. I, myself, was not able to do anything past 4:10.
    We would reaaly apreciate ur help, Sir, if possible.

  8. What I dont get is there are people in comment section pointing out the mistakes in the video. Why some upper level programmers wondering around beginner tutorial videos? Genuinely is there any reason? I never find myself in the videos I already know.

  9. This tutorial series was great, but I think we need an updated version of this. I am incredible confused now that the API website is completely different.

  10. At 8:52 he say's the "now" object is "non-destructive." What does that mean? I'm from Java but I haven't come across that term yet in Java.

  11. Timezones

    Below is a list of recognised timezones. This list is also available via the API. Check the spec for more details.

    Africa/Abidjan

    Africa/Accra

    Africa/Algiers

    Africa/Bissau

    Africa/Cairo

    Africa/Casablanca

    Africa/Ceuta

    Africa/El_Aaiun

    Africa/Johannesburg

    Africa/Juba

    Africa/Khartoum

    Africa/Lagos

    Africa/Maputo

    Africa/Monrovia

    Africa/Nairobi

    Africa/Ndjamena

    Africa/Sao_Tome

    Africa/Tripoli

    Africa/Tunis

    Africa/Windhoek

    America/Adak

    America/Anchorage

    America/Araguaina

    America/Argentina/Buenos_Aires

    America/Argentina/Catamarca

    America/Argentina/Cordoba

    America/Argentina/Jujuy

    America/Argentina/La_Rioja

    America/Argentina/Mendoza

    America/Argentina/Rio_Gallegos

    America/Argentina/Salta

    America/Argentina/San_Juan

    America/Argentina/San_Luis

    America/Argentina/Tucuman

    America/Argentina/Ushuaia

    America/Asuncion

    America/Atikokan

    America/Bahia

    America/Bahia_Banderas

    America/Barbados

    America/Belem

    America/Belize

    America/Blanc-Sablon

    America/Boa_Vista

    America/Bogota

    America/Boise

    America/Cambridge_Bay

    America/Campo_Grande

    America/Cancun

    America/Caracas

    America/Cayenne

    America/Chicago

    America/Chihuahua

    America/Costa_Rica

    America/Creston

    America/Cuiaba

    America/Curacao

    America/Danmarkshavn

    America/Dawson

    America/Dawson_Creek

    America/Denver

    America/Detroit

    America/Edmonton

    America/Eirunepe

    America/El_Salvador

    America/Fort_Nelson

    America/Fortaleza

    America/Glace_Bay

    America/Goose_Bay

    America/Grand_Turk

    America/Guatemala

    America/Guayaquil

    America/Guyana

    America/Halifax

    America/Havana

    America/Hermosillo

    America/Indiana/Indianapolis

    America/Indiana/Knox

    America/Indiana/Marengo

    America/Indiana/Petersburg

    America/Indiana/Tell_City

    America/Indiana/Vevay

    America/Indiana/Vincennes

    America/Indiana/Winamac

    America/Inuvik

    America/Iqaluit

    America/Jamaica

    America/Juneau

    America/Kentucky/Louisville

    America/Kentucky/Monticello

    America/La_Paz

    America/Lima

    America/Los_Angeles

    America/Maceio

    America/Managua

    America/Manaus

    America/Martinique

    America/Matamoros

    America/Mazatlan

    America/Menominee

    America/Merida

    America/Metlakatla

    America/Mexico_City

    America/Miquelon

    America/Moncton

    America/Monterrey

    America/Montevideo

    America/Nassau

    America/New_York

    America/Nipigon

    America/Nome

    America/Noronha

    America/North_Dakota/Beulah

    America/North_Dakota/Center

    America/North_Dakota/New_Salem

    America/Nuuk

    America/Ojinaga

    America/Panama

    America/Pangnirtung

    America/Paramaribo

    America/Phoenix

    America/Port-au-Prince

    America/Port_of_Spain

    America/Porto_Velho

    America/Puerto_Rico

    America/Punta_Arenas

    America/Rainy_River

    America/Rankin_Inlet

    America/Recife

    America/Regina

    America/Resolute

    America/Rio_Branco

    America/Santarem

    America/Santiago

    America/Santo_Domingo

    America/Sao_Paulo

    America/Scoresbysund

    America/Sitka

    America/St_Johns

    America/Swift_Current

    America/Tegucigalpa

    America/Thule

    America/Thunder_Bay

    America/Tijuana

    America/Toronto

    America/Vancouver

    America/Whitehorse

    America/Winnipeg

    America/Yakutat

    America/Yellowknife

    Antarctica/Casey

    Antarctica/Davis

    Antarctica/DumontDUrville

    Antarctica/Macquarie

    Antarctica/Mawson

    Antarctica/Palmer

    Antarctica/Rothera

    Antarctica/Syowa

    Antarctica/Troll

    Antarctica/Vostok

    Asia/Almaty

    Asia/Amman

    Asia/Anadyr

    Asia/Aqtau

    Asia/Aqtobe

    Asia/Ashgabat

    Asia/Atyrau

    Asia/Baghdad

    Asia/Baku

    Asia/Bangkok

    Asia/Barnaul

    Asia/Beirut

    Asia/Bishkek

    Asia/Brunei

    Asia/Chita

    Asia/Choibalsan

    Asia/Colombo

    Asia/Damascus

    Asia/Dhaka

    Asia/Dili

    Asia/Dubai

    Asia/Dushanbe

    Asia/Famagusta

    Asia/Gaza

    Asia/Hebron

    Asia/Ho_Chi_Minh

    Asia/Hong_Kong

    Asia/Hovd

    Asia/Irkutsk

    Asia/Jakarta

    Asia/Jayapura

    Asia/Jerusalem

    Asia/Kabul

    Asia/Kamchatka

    Asia/Karachi

    Asia/Kathmandu

    Asia/Khandyga

    Asia/Kolkata

    Asia/Krasnoyarsk

    Asia/Kuala_Lumpur

    Asia/Kuching

    Asia/Macau

    Asia/Magadan

    Asia/Makassar

    Asia/Manila

    Asia/Nicosia

    Asia/Novokuznetsk

    Asia/Novosibirsk

    Asia/Omsk

    Asia/Oral

    Asia/Pontianak

    Asia/Pyongyang

    Asia/Qatar

    Asia/Qostanay

    Asia/Qyzylorda

    Asia/Riyadh

    Asia/Sakhalin

    Asia/Samarkand

    Asia/Seoul

    Asia/Shanghai

    Asia/Singapore

    Asia/Srednekolymsk

    Asia/Taipei

    Asia/Tashkent

    Asia/Tbilisi

    Asia/Tehran

    Asia/Thimphu

    Asia/Tokyo

    Asia/Tomsk

    Asia/Ulaanbaatar

    Asia/Urumqi

    Asia/Ust-Nera

    Asia/Vladivostok

    Asia/Yakutsk

    Asia/Yangon

    Asia/Yekaterinburg

    Asia/Yerevan

    Atlantic/Azores

    Atlantic/Bermuda

    Atlantic/Canary

    Atlantic/Cape_Verde

    Atlantic/Faroe

    Atlantic/Madeira

    Atlantic/Reykjavik

    Atlantic/South_Georgia

    Atlantic/Stanley

    Australia/Adelaide

    Australia/Brisbane

    Australia/Broken_Hill

    Australia/Darwin

    Australia/Eucla

    Australia/Hobart

    Australia/Lindeman

    Australia/Lord_Howe

    Australia/Melbourne

    Australia/Perth

    Australia/Sydney

    CET

    CST6CDT

    EET

    EST

    EST5EDT

    Etc/GMT

    Etc/GMT+1

    Etc/GMT+10

    Etc/GMT+11

    Etc/GMT+12

    Etc/GMT+2

    Etc/GMT+3

    Etc/GMT+4

    Etc/GMT+5

    Etc/GMT+6

    Etc/GMT+7

    Etc/GMT+8

    Etc/GMT+9

    Etc/GMT-1

    Etc/GMT-10

    Etc/GMT-11

    Etc/GMT-12

    Etc/GMT-13

    Etc/GMT-14

    Etc/GMT-2

    Etc/GMT-3

    Etc/GMT-4

    Etc/GMT-5

    Etc/GMT-6

    Etc/GMT-7

    Etc/GMT-8

    Etc/GMT-9

    Etc/UTC

    Europe/Amsterdam

    Europe/Andorra

    Europe/Astrakhan

    Europe/Athens

    Europe/Belgrade

    Europe/Berlin

    Europe/Brussels

    Europe/Bucharest

    Europe/Budapest

    Europe/Chisinau

    Europe/Copenhagen

    Europe/Dublin

    Europe/Gibraltar

    Europe/Helsinki

    Europe/Istanbul

    Europe/Kaliningrad

    Europe/Kiev

    Europe/Kirov

    Europe/Lisbon

    Europe/London

    Europe/Luxembourg

    Europe/Madrid

    Europe/Malta

    Europe/Minsk

    Europe/Monaco

    Europe/Moscow

    Europe/Oslo

    Europe/Paris

    Europe/Prague

    Europe/Riga

    Europe/Rome

    Europe/Samara

    Europe/Saratov

    Europe/Simferopol

    Europe/Sofia

    Europe/Stockholm

    Europe/Tallinn

    Europe/Tirane

    Europe/Ulyanovsk

    Europe/Uzhgorod

    Europe/Vienna

    Europe/Vilnius

    Europe/Volgograd

    Europe/Warsaw

    Europe/Zaporozhye

    Europe/Zurich

    HST

    Indian/Chagos

    Indian/Christmas

    Indian/Cocos

    Indian/Kerguelen

    Indian/Mahe

    Indian/Maldives

    Indian/Mauritius

    Indian/Reunion

    MET

    MST

    MST7MDT

    PST8PDT

    Pacific/Apia

    Pacific/Auckland

    Pacific/Bougainville

    Pacific/Chatham

    Pacific/Chuuk

    Pacific/Easter

    Pacific/Efate

    Pacific/Enderbury

    Pacific/Fakaofo

    Pacific/Fiji

    Pacific/Funafuti

    Pacific/Galapagos

    Pacific/Gambier

    Pacific/Guadalcanal

    Pacific/Guam

    Pacific/Honolulu

    Pacific/Kiritimati

    Pacific/Kosrae

    Pacific/Kwajalein

    Pacific/Majuro

    Pacific/Marquesas

    Pacific/Nauru

    Pacific/Niue

    Pacific/Norfolk

    Pacific/Noumea

    Pacific/Pago_Pago

    Pacific/Palau

    Pacific/Pitcairn

    Pacific/Pohnpei

    Pacific/Port_Moresby

    Pacific/Rarotonga

    Pacific/Tahiti

    Pacific/Tarawa

    Pacific/Tongatapu

    Pacific/Wake

    Pacific/Wallis