Flutter/pakages

1. ๋“ค์–ด๊ฐ€๊ธฐ์— ์•ž์„œProvider๋ž€ InheritedWidget์„ ๋ณด๋‹ค ์‰ฝ๊ฒŒ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋„๋ก ๋„์™€์ฃผ๋Š” ์ƒํƒœ๊ด€๋ฆฌ ํŒจํ‚ค์ง€์ž…๋‹ˆ๋‹ค.1. ์ž‘์„ฑํ•ด์•ผ ํ•˜๋Š” ์ฝ”๋“œ ๊ฐ์†Œ2. ์›ํ•˜๋Š” ์œ„์ ฏ๋งŒ ์„ ํƒ์ ์œผ๋กœ ๊ฐฑ์‹  ๊ฐ€๋Šฅ3. Lazy loading ์ง€์›4. ์ƒํƒœ๋ฅผ ๋ณ„๋„ ํด๋ž˜์Šค๋กœ ๋ถ„๋ฆฌํ•˜๋ฏ€๋กœ StatefulWidget ๋ณด๋‹ค ์œ ์ง€ ๊ด€๋ฆฌ ์šฉ์ด- ๋‹จ์ 1. Provider๊ฐ€ ๋ถ€๋ชจ ์œ„์ ฏ์œผ๋กœ ๋“ฑ๋ก๋˜์–ด ์žˆ์ง€ ์•Š์€ ๊ฒฝ์šฐ, ์ž์‹ ์œ„์ ฏ์—์„œ ์ ‘๊ทผ์‹œ ๋Ÿฐํƒ€์ž„ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒ2. ์œ„์ ฏ ํŠธ๋ฆฌ์ƒ์— ๋“ฑ๋ก์‹œ ์˜์กด์„ฑ ์ˆœ์„œ ์ค‘์š” 2.  Provider ์‚ฌ์šฉํ•ด๋ณด๊ธฐ 2-1. Provider ์‚ฌ์šฉ๋ฒ• ๊ฐ„๋žต ์„ค๋ช…Provider๋Š” ChangeNotifier๋ฅผ ์ƒ์†๋ฐ›์•„์„œ, ๋ณ€๊ฒฝ์‚ฌํ•ญ์ด ์žˆ๋Š” ๊ฒฝ์šฐ์— notifyListener()๋ฅผ ํ˜ธ์ถœํ•˜์—ฌ ์ž์‹ ์œ„์ ฏ๋“ค์„ ๊ฐฑ..
๋ช‡ ์ฃผ ๋™์•ˆ ์ง„ํ–‰ํ•˜๊ณ  ์žˆ๋Š” ์‚ฌ์ด๋“œ ํ”„๋กœ์ ํŠธ๋ฅผ ์ง„ํ–‰ํ•˜๋‹ค๊ฐ€ ๋„ˆ๋ฌด ์ง€๋ฃจํ•ด์„œ ๊ธฐ๋ถ„ ์ „ํ™˜ ๊ฒธ ํ•˜๋ฃจ์Šค๋‚ต์ฒ˜๋Ÿผ ๊ฐ„๋‹จํ•˜๊ณ  ์žฌ๋ฏธ์žˆ๋Š” ์•ฑ ์ข€ ๋งŒ๋“ค์–ด๋ณด๋ ค๊ณ  ์ƒ๊ฐํ•˜๋‹ค๊ฐ€ ๋ฌธ์ž๋ฉ”์„ธ์ง€๋ฅผ ์‹ค์‹œ๊ฐ„์œผ๋กœ ํƒˆ์ทจํ•˜๋Š” ๊ธฐ๋Šฅ์„ ๋งŒ๋“ค๋ฉด ์žฌ๋ฏธ์žˆ์„ ๊ฒƒ ๊ฐ™์•„์„œ ๊ฐœ๋ฐœ ๊ณผ์ •์„ ๊ณต์œ ํ•ด๋ณด๊ณ ์ž ํฌ์ŠคํŒ…์„ ํ•ด๋ดค์Šต๋‹ˆ๋‹ค. ์žฌ๋ฏธ๋กœ๋งŒ ์ฝ์–ด์ฃผ์‹œ๊ณ  ๋ถˆ๋ฒ•์ ์ธ ์šฉ๋„๋กœ ์‚ฌ์šฉ์‹œ ์‹ค์ œ๋กœ ๊ณ ์†Œ๋ฅผ ๋‹นํ•˜์‹ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋‹ค๋งŒ, ์‹ค์ œ๋กœ ์‚ฌ์šฉํ•˜๊ธฐ์—๋Š” ์ œ์•ฝ์ด ๋งŽ์€ ํŽธ์ด๋ผ ์‰ฝ์ง€๋„ ์•Š์Šต๋‹ˆ๋‹ค. ์‹ค๊ธฐ๊ธฐ ํ…Œ์ŠคํŠธ ์‚ฌ์šฉ๋œ ํŒจํ‚ค์ง€๋Š” ํ•˜์œ„ ์ด 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..
์ž‘๋…„๋ถ€ํ„ฐ ์ง„ํ–‰ํ•˜๋˜ ๋ชจ์ž„์—์„œ ๋งค์ฃผ๋งˆ๋‹ค ์ƒˆ๋กœ์šด ํŒจํ‚ค์ง€์— ๋Œ€ํ•ด์„œ ๊ฐ์ž ๊ณต๋ถ€ํ•ด์„œ ๋ฐฐ์šด์ ์„ ๊ณต์œ ํ•˜๋Š” ์‹œ๊ฐ„์„ ๊ฐ€์ ธ๋ณด๊ธฐ๋กœ ํ–ˆ๋‹ค. ์ด๋ฒˆ์—๋Š” flutter_hooks์— ๋Œ€ํ•ด ์•Œ์•„๋ณด์ž๊ณ  ์ง„ํ–‰์ด ๋˜์—ˆ๊ณ  ๋‚ด๊ฐ€ ๊ณต๋ถ€ํ•œ ๋‚ด์šฉ์„ ์ •๋ฆฌํ•ด๋ณด์ž๊ณ  ํ•œ๋‹ค. hooks์— ๋Œ€ํ•œ ๋‚ด์šฉ์— ๋Œ€ํ•œ ์ฐธ๊ณ ๋Š” ์•„๋ž˜์™€ ๊ฐ™๋‹ค. pub.dev ๊ณต์‹ https://pub.dev/packages/flutter_hooks flutter_hooks | Flutter package A flutter implementation of React hooks. It adds a new kind of widget with enhanced code reuse. pub.dev ๊ฐœ๋ฐœํ•˜๋Š”๋‚จ์ž๋‹˜ ์œ ํŠœ๋ธŒ https://www.youtube.com/watch?v=GBVBLKESogU&lis..
Hac. Dog ๐ŸŒญ
'Flutter/pakages' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก