bloc

    Flutter BLoC ๊ฟ€ํŒ - 1ํƒ„ : BlocProvider ๋ฐฑ๋ฐฐ ์‚ฌ์šฉํ•˜๊ธฐ

    BLoC ํŒจํ„ด์„ ์‚ฌ์šฉํ•˜์‹œ๋Š” ๋ถ„์ด๋ผ๋ฉด BlocProvider ๋ฅผ ์‚ฌ์šฉํ•˜์‹ค๊ฒ๋‹ˆ๋‹ค. ์˜ค๋Š˜์€ BlocProvider ๋ฅผ ์ข€ ๋” ์ž˜์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด์„œ ์•Œ๋ ค๋“œ๋ฆฌ๊ฒ ์Šต๋‹ˆ๋‹ค. ์ด๋ฒˆ ๊ธ€์€ ์ €์˜ ๊ฐœ๋ฐœ ๊ฒฝํ—˜์„ ๊ธฐ๋ฐ˜์œผ๋กœ ์ž‘์„ฑ๋์Šต๋‹ˆ๋‹ค. ์ด ๊ธ€์—์„œ ์•Œ์•„๋ณผ ๋‚ด์šฉ ๋‹ค๋ฅธ ์Šคํฌ๋ฆฐ์—์„œ ๋™์ผํ•œ BlocProvider ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ• BlocProvider ์˜ auto dispose ๋ฌธ์ œ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ• ๋‹ค๋ฅธ ์Šคํฌ๋ฆฐ์—์„œ ๋™์ผํ•œ BlocProvider๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ• BlocProvider ์˜ ์Šค์ฝ”ํ”„๋Š” ๊ฐ์‹ธ๊ณ  ์žˆ๋Š” Widget ๊นŒ์ง€๊ฐ€ ๋ฒ”์œ„์ž…๋‹ˆ๋‹ค. ๋งŒ์•ฝ Navigator ๋ฅผ ํ†ตํ•ด ๋‹ค๋ฅธ ์Šคํฌ๋ฆฐ์œผ๋กœ ์ „ํ™˜ํ•œ๋‹ค๋ฉด ์ „ํ™˜ํ•œ ํ™”๋ฉด์€ BlocProvider ์˜ ์Šค์ฝ”ํ”„ ๋ฐ–์ž…๋‹ˆ๋‹ค. ์ด๋ฅผ ํ•ด๊ฒฐํ•˜๋Š” ๋ฉ์ฒญํ•œ ๋ฐฉ๋ฒ•์€ ๋‹ค์Œ๊ณผ ๊ฐ™์•˜์Šต๋‹ˆ๋‹ค. runApp( BlocPro..

    Flutter Provider + '?' ํŒจํ„ด  (feat. ChangeNotifier, Mobx, BLoC, etc..)

    Flutter Provider + '?' ํŒจํ„ด (feat. ChangeNotifier, Mobx, BLoC, etc..)

    Flutter๋ฅผ ํ•˜๋ฉด ํ•ญ์ƒ ๋˜์ง€๊ฒŒ ๋˜๋Š” ์งˆ๋ฌธ์ด ์žˆ์Šต๋‹ˆ๋‹ค. ์–ด๋–ป๊ฒŒ ์ƒํƒœ๊ด€๋ฆฌ ํŒจํ„ด์„ ๊ตฌ์ถ•ํ• ์ง€์— ๋Œ€ํ•œ ๋‹ต์ž…๋‹ˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  ์•„๋ž˜๊ฐ€ ๊ทธ์— ๋Œ€ํ•œ ๋Œ€๋‹ต์ž…๋‹ˆ๋‹ค. ๊ทธ๋ž˜๋„ ๊ตฌ๊ธ€์€ ๋งค I/O ๋•Œ๋งˆ๋‹ค ์ƒํƒœ๊ด€๋ฆฌ ํŒจํ„ด์— ๋Œ€ํ•ด์„œ ์†Œ๊ฐœํ•ด์™”์Šต๋‹ˆ๋‹ค. ๋‹ค์Œ์€ ๊ฐ ๋…„๋„๋ณ„ ์†Œ๊ฐœ๋œ ํŒจํ„ด์ž…๋‹ˆ๋‹ค. 2018 2018 Google I/O (ScopedModel, BLoC) 2019 2019 Google I/O (Provider+ChangeNotifier) 2019 I/O. Provider+ChangeNotifier๊ฐ€ ์˜ˆ์‹œ๋กœ ์†Œ๊ฐœ๋์Šต๋‹ˆ๋‹ค. ์–ธ๋œป ๋ณด๋ฉด ์ด ์ž์ฒด๋กœ ProviderํŒจํ„ด์˜ ์™„์„ฑ์œผ๋กœ ๋ณด์ž…๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ ๊ฐ„๊ณผํ•˜๊ณ  ์žˆ๋Š”๊ฒŒ ์žˆ์Šต๋‹ˆ๋‹ค. Provider๋Š” ํŒจํ„ด์ด ์•„๋‹ˆ๋ผ ํŒจํ‚ค์ง€์ž…๋‹ˆ๋‹ค. Provider+ChangeNotifier๊ฐ€ ํŒจํ„ด์ด์ง€ Provider๋Š” I..