์ „์ฒด ๊ธ€

Hello World
1. ๋“ค์–ด๊ฐ€๊ธฐ์— ์•ž์„œProvider๋ž€ InheritedWidget์„ ๋ณด๋‹ค ์‰ฝ๊ฒŒ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋„๋ก ๋„์™€์ฃผ๋Š” ์ƒํƒœ๊ด€๋ฆฌ ํŒจํ‚ค์ง€์ž…๋‹ˆ๋‹ค.1. ์ž‘์„ฑํ•ด์•ผ ํ•˜๋Š” ์ฝ”๋“œ ๊ฐ์†Œ2. ์›ํ•˜๋Š” ์œ„์ ฏ๋งŒ ์„ ํƒ์ ์œผ๋กœ ๊ฐฑ์‹  ๊ฐ€๋Šฅ3. Lazy loading ์ง€์›4. ์ƒํƒœ๋ฅผ ๋ณ„๋„ ํด๋ž˜์Šค๋กœ ๋ถ„๋ฆฌํ•˜๋ฏ€๋กœ StatefulWidget ๋ณด๋‹ค ์œ ์ง€ ๊ด€๋ฆฌ ์šฉ์ด- ๋‹จ์ 1. Provider๊ฐ€ ๋ถ€๋ชจ ์œ„์ ฏ์œผ๋กœ ๋“ฑ๋ก๋˜์–ด ์žˆ์ง€ ์•Š์€ ๊ฒฝ์šฐ, ์ž์‹ ์œ„์ ฏ์—์„œ ์ ‘๊ทผ์‹œ ๋Ÿฐํƒ€์ž„ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒ2. ์œ„์ ฏ ํŠธ๋ฆฌ์ƒ์— ๋“ฑ๋ก์‹œ ์˜์กด์„ฑ ์ˆœ์„œ ์ค‘์š” 2.  Provider ์‚ฌ์šฉํ•ด๋ณด๊ธฐ 2-1. Provider ์‚ฌ์šฉ๋ฒ• ๊ฐ„๋žต ์„ค๋ช…Provider๋Š” ChangeNotifier๋ฅผ ์ƒ์†๋ฐ›์•„์„œ, ๋ณ€๊ฒฝ์‚ฌํ•ญ์ด ์žˆ๋Š” ๊ฒฝ์šฐ์— notifyListener()๋ฅผ ํ˜ธ์ถœํ•˜์—ฌ ์ž์‹ ์œ„์ ฏ๋“ค์„ ๊ฐฑ..
๋“ค์–ด๊ฐ€๊ธฐ ์•ž์„œ ๊ทธ๋™์•ˆ Flutter๋กœ ๊ฐœ๋ฐœ์„ ํ•ด์˜ค๋ฉด์„œ Future๋ฅผ ๋งŽ์ด ์‚ฌ์šฉํ•ด๋ณด์•˜๋Š”๋ฐ, ์ƒ๊ฐ๋ณด๋‹ค ์–ด๋–ป๊ฒŒ ๋™์ž‘ํ•˜๋Š”์ง€ ์˜๊ตฌ์‹ฌ์„ ๊ฐ€์ง€๋ฉด์„œ ์ฝ”๋”ฉํ•˜์ง€ ์•Š์•˜๋‹ค. ๋‹จ์ˆœํ•˜๊ฒŒ await๋ฅผ ์“ฐ๋ฉด ๊ธฐ๋‹ค๋ฆฌ๊ณ  Future๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ์ผ๋‹จ ์–˜๋Š” ๊ธฐ๋‹ค๋ฆฌ๋ฉด ๋‚˜์ค‘์— ๊ฐ’์„ ์ฃผ๋Š” ์–˜๊ตฌ๋‚˜ ๋ผ๊ณ  ๋ง‰์—ฐํ•˜๊ฒŒ ์ƒ๊ฐํ–ˆ๋‹ค. ์ด๋ฒˆ ๊ธฐํšŒ์— ์ž์„ธํžˆ ์•Œ์•„๋ณด๋ฉด์„œ ๊ทธ์— ๋Œ€ํ•œ ๊ณต๋ถ€ ๋‚ด์šฉ์„ ์ •๋ฆฌํ•˜๊ณ ์ž ํ•œ๋‹ค. 1. Dart์˜ ๋น„๋™๊ธฐ ๋™์ž‘ ์›๋ฆฌ Dart๋Š” ์‹ฑ๊ธ€ ์Šค๋ ˆ๋“œ๋กœ ์šด์˜๋˜๋Š” ์–ธ์–ด์ด๋‹ค. Dart์—์„œ Future๊ฐ€ ์žˆ๋‹ค๋ฉด ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ์—์„œ๋Š” Promise๊ฐ€ ์žˆ๋‹ค, ๋‘˜๋‹ค ์‹ฑ๊ธ€ ์Šค๋ ˆ๋“œ๋กœ ๋™์ž‘์ด ๋œ๋‹ค. ๊ทธ๋ ‡๋‹ค๋ฉด ์‹ฑ๊ธ€ ์Šค๋ ˆ๋“œ๋Š” ์–ด๋–ป๊ฒŒ ๋™์ž‘์„ ํ•˜๋Š” ๊ฒƒ์ผ๊นŒ? for(int i=0; i print('Future is complete')); print('After the Futur..
๋ช‡ ์ฃผ ๋™์•ˆ ์ง„ํ–‰ํ•˜๊ณ  ์žˆ๋Š” ์‚ฌ์ด๋“œ ํ”„๋กœ์ ํŠธ๋ฅผ ์ง„ํ–‰ํ•˜๋‹ค๊ฐ€ ๋„ˆ๋ฌด ์ง€๋ฃจํ•ด์„œ ๊ธฐ๋ถ„ ์ „ํ™˜ ๊ฒธ ํ•˜๋ฃจ์Šค๋‚ต์ฒ˜๋Ÿผ ๊ฐ„๋‹จํ•˜๊ณ  ์žฌ๋ฏธ์žˆ๋Š” ์•ฑ ์ข€ ๋งŒ๋“ค์–ด๋ณด๋ ค๊ณ  ์ƒ๊ฐํ•˜๋‹ค๊ฐ€ ๋ฌธ์ž๋ฉ”์„ธ์ง€๋ฅผ ์‹ค์‹œ๊ฐ„์œผ๋กœ ํƒˆ์ทจํ•˜๋Š” ๊ธฐ๋Šฅ์„ ๋งŒ๋“ค๋ฉด ์žฌ๋ฏธ์žˆ์„ ๊ฒƒ ๊ฐ™์•„์„œ ๊ฐœ๋ฐœ ๊ณผ์ •์„ ๊ณต์œ ํ•ด๋ณด๊ณ ์ž ํฌ์ŠคํŒ…์„ ํ•ด๋ดค์Šต๋‹ˆ๋‹ค. ์žฌ๋ฏธ๋กœ๋งŒ ์ฝ์–ด์ฃผ์‹œ๊ณ  ๋ถˆ๋ฒ•์ ์ธ ์šฉ๋„๋กœ ์‚ฌ์šฉ์‹œ ์‹ค์ œ๋กœ ๊ณ ์†Œ๋ฅผ ๋‹นํ•˜์‹ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋‹ค๋งŒ, ์‹ค์ œ๋กœ ์‚ฌ์šฉํ•˜๊ธฐ์—๋Š” ์ œ์•ฝ์ด ๋งŽ์€ ํŽธ์ด๋ผ ์‰ฝ์ง€๋„ ์•Š์Šต๋‹ˆ๋‹ค. ์‹ค๊ธฐ๊ธฐ ํ…Œ์ŠคํŠธ ์‚ฌ์šฉ๋œ ํŒจํ‚ค์ง€๋Š” ํ•˜์œ„ ์ด 3๊ฐœ ์ž…๋‹ˆ๋‹ค. https://pub.dev/packages/telephony telephony | Flutter package A Flutter plugin to use telephony features such as fetch network info, start phon..
pub.dev์—์„œ ํŒจํ‚ค์ง€ ์ข‹์€๊ฑฐ ์—†๋‚˜ ๋‘˜๋Ÿฌ๋ณด๋‹ค๊ฐ€ ์ƒ๊ฐ๋ณด๋‹ค ์ธ๊ธฐ๊ฐ€ ์žˆ์–ด๋ณด์ด๋Š” ์•ฑ์„ ๋ฐœ๊ฒฌํ–ˆ์Šต๋‹ˆ๋‹ค. ํŒจํ‚ค์ง€ ํ”Œ๋Ÿฌ์Šค..? ๊ฐ€ ๋ญ์ง€.... ๋ผ๊ณ  ์ƒ๊ฐํ•˜๋ฉด์„œ ์‚ฌ์šฉ๋ฒ•์„ ์ฝ์–ด๋ณด๋Š”๋ฐ ๋ญ์ง€..? ๋” ๋ชจ๋ฅด๊ฒ ๋Š”๋ฐ ์ผ๋‹จ ์‚ฌ์šฉํ•ด๋ณธ๊ฒฐ๊ณผ ํ˜„์žฌ ํ”„๋กœ์ ํŠธ์˜ ํŒจํ‚ค์ง€๊ด€๋ จ๋œ ๋‚ด์šฉ์„ ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์žˆ๋Š” ํŒจํ‚ค์ง€์ธ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. ์‚ฌ์šฉ๋ฒ•์€ ๊ฐ„๋‹จํ•ฉ๋‹ˆ๋‹ค. pubspec.yaml ํŒŒ์ผ์— ํŒจํ‚ค์ง€๋ฅผ ์ถ”๊ฐ€ํ•˜๊ณ  // `PackageInfo.fromPlatform()`์ „์— ์ด ๋ผ์ธ์„ ํ˜ธ์ถœํ•˜์„ธ์š” WidgetsFlutterBinding.ensureInitialized(); PackageInfo packageInfo = await PackageInfo.fromPlatform(); ์œ„ ๋‘๊ฐœ๋ฅผ runApp() ์‹คํ–‰์ „์— ์‹คํ–‰์‹œ์ผœ ์ฃผ๊ณ  String appName = packag..
์ด๋ฒˆ์— ์†Œ๊ฐœํ•  ํŒจํ‚ค์ง€๋Š” pull_to_refresh๋ผ๋Š” ๋กœ๋”ฉ ์ธ๋””์ผ€์ดํ„ฐ๋ฅผ ๋ณ€๊ฒฝํ•  ์ˆ˜ ์žˆ๋Š” ํŒจํ‚ค์ง€์ด๋‹ค. https://pub.dev/packages/pull_to_refresh pull_to_refresh | Flutter package a widget provided to the flutter scroll component drop-down refresh and pull up load. pub.dev Pub.dev์— 2533 LIKES์ธ๊ฒƒ์„ ๋ณด๋‹ˆ, ๊ฝค ๋งŽ์€ ์‚ฌ๋žŒ๋“ค์ด ์‚ฌ์šฉํ•˜๊ณ  ์žˆ๊ณ  ์–ด๋Š์ •๋„ ๊ฒ€์ฆ๋œ ํŒจํ‚ค์ง€๋ผ๋Š” ์˜๋ฏธ์ด๋‹ค. ์ด์ œ ์–ด๋–ป๊ฒŒ ์‚ฌ์šฉํ•˜๋Š”์ง€ ์ฐจ๊ทผํžˆ ์•Œ์•„๋ณด์ž. ๊ทธ์ „์— ํ˜น์‹œ ๋ฌด์Šจ ํŒจํ‚ค์ง€์ธ์ง€ ๊ฐ์„ ์•ˆ์˜ค๋Š” ๋ถ„๋“ค์„ ์œ„ํ•ด์„œ ๋™์ž‘ ์ด๋ฏธ์ง€๋ฅผ ๊ฐ„๋‹จํžˆ ๋ณด์—ฌ์ฃผ์ž๋ฉด ์šฐ๋ฆฌ๊ฐ€ Flutter๋‚ด์žฅ ํ•จ์ˆ˜์ธ RefreshIndicator..
๋‘๋ฒˆ์งธ๋กœ๋Š” hook์— useMemoized function์— ๋Œ€ํ•ด์„œ ์•Œ์•„๋ณด์ž. useMemoized์— ๋Œ€ํ•ด ๊ฐ„๋‹จํžˆ ์ด์•ผ๊ธฐ ํ•˜์ž๋ฉด, ๊ฐ’์„ ๋ฉ”๋ชจ๋ฆฌ์— ์ €์žฅํ•˜๊ณ  ์žˆ๋‹ค๊ฐ€ ๊ฐ’์ด ๋ณ€ํ•œ๋‹ค๋ฉด ์žฌ๋นŒ๋“œ, ์•„๋‹ˆ๋ผ๋ฉด ์•„๋ฌด ๋ณ€ํ™”๋„ ์ฃผ์ง€ ์•Š๋Š”๋‹ค. ์ฆ‰ oldValue(๋ฉ”๋ชจ๋ฆฌ์— ์ €์žฅ๋œ ๊ฐ’)๊ณผ currentValue(ํ˜„์žฌ ๊ฐ’)๋ฅผ ๋‘๊ฐœ๋ฅผ ๊ณ„์† ๋น„๊ตํ•˜๋ฉด์„œ ์ƒํƒœ๋ฅผ ๋ณ€๊ฒฝํ•œ๋‹ค๊ณ  ์ดํ•ดํ•˜๋ฉด ์•„์ฃผ ์‰ฝ๊ฒŒ ์ดํ•ดํ•  ์ˆ˜ ์žˆ์„ ๊ฒƒ ์ด๋‹ค. ์ผ๋‹จ Implementation์— ๋Œ€ํ•ด์„œ ์•Œ์•„๋ณด์ž. ์ธ์ž๊ฐ’์œผ๋กœ Function ํ•จ์ˆ˜์™€ List๋ฅผ ๋ฐ›๋Š”๋‹ค. ๋‚˜๋Š” computerExpensiveOperation์ด๋ผ๋Š” ํ•จ์ˆ˜๋ฅผ ๋งŒ๋“ค๊ณ  useMemorized๋กœ ์‹คํ–‰ํ•˜๋„๋ก ๊ตฌํ˜„ํ•˜์˜€๋‹ค. int computerExpensiveOperation(int count) { print('useM..
Hac. Dog ๐ŸŒญ
Hac. Dog : Blog