๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

Flutter

[ Flutter ]flutter์—์„œ setTimeout๊ณผ ๊ฐ™์€ ํƒ€์ด๋จธ ์„ค์ •ํ•˜๊ธฐ.

 

 

web API ์ค‘ ํ•˜๋‚˜์ธ setTimeout() method ์™€ ๊ฐ™์€ ์—ญํ• ์„ ํ•˜๋Š” dart์˜ method๋Š” ๋ฌด์—‡์ผ๊นŒ? ๐Ÿค”

 

 

๋‚˜๋Š” Flutter ๊ณต์‹ ํŽ˜์ด์ง€์— ๋‚˜์™€์žˆ๋Š” dart:async > Timer class ๋ฅผ ์ด์šฉํ–ˆ๋‹ค.

Timer Class๋Š” Null safety๊ฐ€ ์ง€์›๋˜๋Š” ์ถ”์ƒ ํด๋ž˜์Šค ์ด๋‹ค.

 

 

 

๊ณต์‹ํŽ˜์ด์ง€์— ์žˆ๋Š” ๊ธ€์„ ์ฐธ๊ณ ํ•˜์—ฌ ์ž‘์„ฑํ•œ ๋‚˜์˜ ๊ฐ„๋‹จํ•œ ์ฝ”๋“œ.

Timer(Duration(seconds: 3), () {
        Get.to(AddressListPage());
      });

์‹คํ–‰ ๊ฒฐ๊ณผ๋Š” 3์ดˆ ํ›„ GetX ์˜ Get.to()๋ฅผ ์ด์šฉํ•˜์—ฌ AddressListPage๋กœ ์ด๋™ํ•œ๋‹ค. ๐Ÿฅณ

 

 

 

 

 

 

 

๐Ÿ‘‰ ๋ฐ˜๋ณต ์•ก์…˜์„ ์ฃผ๋ ค๋ฉด Timer.periodic ์„ ์‚ฌ์šฉํ•˜๋ฉด ๋œ๋‹ค๊ณ  ํ•œ๋‹ค.

์ฐธ๊ณ ๊ธ€: https://fluttermaster.com/tips-to-use-timer-in-dart-and-flutter/