{"id":297507,"date":"2020-01-22T15:00:27","date_gmt":"2020-01-22T15:00:27","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=297507"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=297507","title":{"rendered":"Flutter BloC \u043f\u0430\u0442\u0442\u0435\u0440\u043d + Provider + \u0442\u0435\u0441\u0442\u044b + \u0437\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435"},"content":{"rendered":"\n<div class=\"post__text post__text-html\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/485002\/\">\n<p>\u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0432\u044b\u0440\u043e\u0441\u043b\u0430 \u0438\u0437 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u201c<a href=\"https:\/\/habr.com\/ru\/post\/475404\/\">BLoC \u043f\u0430\u0442\u0442\u0435\u0440\u043d \u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435<\/a>\u201d \u0433\u0434\u0435 \u043c\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c, \u0447\u0442\u043e \u044d\u0442\u043e \u0437\u0430 \u043f\u0430\u0442\u0442\u0435\u0440\u043d \u0438 \u043a\u0430\u043a \u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0432 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0441\u0447\u0435\u0442\u0447\u0438\u043a\u0430.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u043c \u0438 \u0434\u043b\u044f \u0441\u0432\u043e\u0435\u0433\u043e \u043b\u0443\u0447\u0448\u0435\u0433\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u044b \u043e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441\u044b:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u041a\u0430\u043a \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f BloC \u043f\u043e \u0432\u0441\u0435\u043c\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e<\/li>\n<li>\u041a\u0430\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u044b \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430<\/li>\n<li>(\u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441) \u041a\u0430\u043a \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0436\u0434\u0443 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043c\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043e\u0441\u0442\u0430\u0432\u0430\u044f\u0441\u044c \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 BLoC \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u041d\u0438\u0436\u0435 \u0430\u043d\u0438\u043c\u0430\u0448\u043a\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0435\u0433\u043e\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430, \u0430 \u043f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c \u0440\u0430\u0437\u0431\u043e\u0440 \u043f\u043e\u043b\u0435\u0442\u043e\u0432 \ud83d\ude42<\/p>\n<p>  <\/p>\n<p>\u0418 \u0435\u0449\u0451 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u043a\u0430 \u2014 \u043a\u0430\u043a \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f <a href=\"http:\/\/reactivex.io\/documentation\/operators\/debounce.html\" rel=\"nofollow\">Debounce \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0438\u0437 ReactiveX<\/a> \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430 (\u0435\u0441\u043b\u0438 \u0442\u043e\u0447\u043d\u0435\u0435, \u0442\u043e reactiveX \u2014 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 Observer pattern)<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/yi\/5d\/vd\/yi5dvd5xtr5lopselzm4tywl8ey.gif\"><a name=\"habracut\"><\/a><\/p>\n<h2 id=\"opisanie-prilozheniya-i-bazovogo-koda\">\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u043a\u043e\u0434\u0430<\/h2>\n<p>  <\/p>\n<p><strong>\u041d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044f \u043a BLoC \u0438 Provider<\/strong><\/p>\n<p>  <\/p>\n<ol>\n<li>\u0412 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0435\u0441\u0442\u044c \u043a\u043d\u043e\u043f\u043e\u0447\u043a\u0438 +- \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0441\u0432\u0430\u0439\u043f\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0443\u0431\u043b\u0438\u0440\u0443\u044e\u0442 \u044d\u0442\u0438 \u043a\u043d\u043e\u043f\u043a\u0438<\/li>\n<li>\u0410\u043d\u0438\u043c\u0430\u0446\u0438\u044f \u0441\u0434\u0435\u043b\u0430\u043d\u0430 \u0447\u0435\u0440\u0435\u0437 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u0432\u043e flutter mixin \u2014 TickerProviderStateMixin<\/li>\n<\/ol>\n<p>  <\/p>\n<p><strong>\u0421\u0432\u044f\u0437\u0430\u043d\u043e \u0441 BLoC \u0438 Provider<\/strong><\/p>\n<p>  <\/p>\n<ol>\n<li>\u0414\u0432\u0430 \u044d\u043a\u0440\u0430\u043d\u0430 \u2014 \u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u0441\u0432\u0430\u0439\u043f\u0430\u0435\u043c, \u043d\u0430 \u0432\u0442\u043e\u0440\u043e\u043c \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u044e\u0442\u0441\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u0447\u0435\u0442\u0447\u0438\u043a\u0430<\/li>\n<li>\u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0432 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430 (iOS &amp; Android, \u043f\u0430\u043a\u0435\u0442 <a href=\"https:\/\/pub.dev\/packages\/shared_preferences\" rel=\"nofollow\">https:\/\/pub.dev\/packages\/shared_preferences<\/a>)<\/li>\n<li>\u0417\u0430\u043f\u0438\u0441\u044c \u0438 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0438\u0437 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e\u0433\u043e \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u0430\u044f, \u0442\u043e\u0436\u0435 \u0434\u0435\u043b\u0430\u0435\u043c \u0447\u0435\u0440\u0435\u0437 BLoC<\/li>\n<\/ol>\n<p>  <\/p>\n<h2 id=\"pishem-prilozhenie\">\u041f\u0438\u0448\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0437 <a href=\"https:\/\/habr.com\/ru\/post\/475404\/\">\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430 BLoC<\/a> \u043d\u0430\u0448\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u0443\u0431\u0440\u0430\u0442\u044c \u0438\u0437 \u0432\u0438\u0434\u0436\u0435\u0442\u043e\u0432 \u0432\u0441\u044e \u043b\u043e\u0433\u0438\u043a\u0443 \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0447\u0435\u0440\u0435\u0437 \u043a\u043b\u0430\u0441\u0441 \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0432\u0441\u0435 \u0432\u0445\u043e\u0434\u044b \u0438 \u0432\u044b\u0445\u043e\u0434\u044b \u2014 Streams.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u044d\u0442\u043e\u043c, \u0442\u0430\u043a \u043a\u0430\u043a \u043a\u043b\u0430\u0441\u0441 \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f BLoC \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u044d\u043a\u0440\u0430\u043d\u0430\u0445, \u0442\u043e \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u043f\u043e \u0432\u0441\u0435\u043c\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u041f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u044b \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0439 <a href=\"https:\/\/flutter.dev\/docs\/development\/data-and-backend\/state-mgmt\/simple\" rel=\"nofollow\">lifting state up<\/a>. \u041d\u0435 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u0447\u0435\u043d\u044c \u0437\u0430\u043f\u0443\u0442\u0430\u043d\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u043f\u043e\u0442\u043e\u043c \u043d\u0435 \u043e\u0442\u0441\u043b\u0435\u0434\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439.<\/li>\n<li>\u0421\u0434\u0435\u043b\u0430\u0442\u044c \u0438\u0437 \u043a\u043b\u0430\u0441\u0441\u0430 \u0433\u0434\u0435 \u0443 \u043d\u0430\u0441 BLoC \u0441\u0438\u043d\u0433\u043b\u0442\u043e\u043d \u0438 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0433\u0434\u0435 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e. \u042d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0438 \u0443\u0434\u043e\u0431\u043d\u043e, \u043d\u043e, \u0441 \u043c\u043e\u0435\u0439 \u0441\u0443\u0433\u0443\u0431\u043e \u043b\u0438\u0447\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f, \u0443\u0441\u043b\u043e\u0436\u043d\u044f\u0435\u0442 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 \u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0437\u0430\u043f\u0443\u0442\u044b\u0432\u0430\u0435\u0442 \u043b\u043e\u0433\u0438\u043a\u0443.<\/li>\n<li>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u043a\u0435\u0442 Provider \u2014 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 Flutter \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f\u043c\u0438. \u0421\u043c. \u0432\u0438\u0434\u0435\u043e <a href=\"https:\/\/youtu.be\/d_m5csmrf7I\" rel=\"nofollow\">https:\/\/youtu.be\/d_m5csmrf7I<\/a> <\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Provider \u2014 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043f\u0440\u0438\u043c\u0435\u0440 \u0432\u0441\u0435\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043d\u0435 \u0445\u0432\u0430\u0442\u0438\u043b\u043e \u0441\u0438\u043b \ud83d\ude42<\/p>\n<p>  <\/p>\n<p><strong>\u041e\u0431\u0449\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430<\/strong><\/p>\n<p>  <\/p>\n<p>\u0418\u0442\u0430\u043a, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043a\u043b\u0430\u0441\u0441<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">class SwipesBloc {     \/\/ some stuff }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0438, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430, \u0431\u044b\u043b \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043f\u043e \u0432\u0441\u0435\u043c\u0443 \u0434\u0435\u0440\u0435\u0432\u0443 \u0432\u0438\u0434\u0436\u0435\u0442\u043e\u0432, \u043c\u044b, \u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u0432\u0438\u0434\u0436\u0435\u0442\u043e\u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440 \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430. \u042f \u0441\u0434\u0435\u043b\u0430\u043b \u044d\u0442\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0432\u0435\u0440\u0445\u0443 \u0434\u0435\u0440\u0435\u0432\u0430 \u0432\u0438\u0434\u0436\u0435\u0442\u043e\u0432, \u043d\u043e \u043b\u0443\u0447\u0448\u0435 \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043d\u0443\u0436\u043d\u043e\u043c \u043d\u0438\u0437\u043a\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435.<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">class MyApp extends StatelessWidget {   @override   Widget build(BuildContext context) {     return MultiProvider(       providers: [         Provider&lt;SwipesBloc&gt;(create: (_) =&gt; SwipesBloc()),       ],       child: MaterialApp(         title: 'Swipe BLoC + Provider',<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u043a\u0440\u0430\u0441\u0438\u0432\u043e\u0439 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0432 \u043b\u044e\u0431\u043e\u043c \u0432\u0438\u0434\u0436\u0435\u0442\u0435 \u0432\u043d\u0438\u0437\u0443 \u0434\u0435\u0440\u0435\u0432\u0430 \u043d\u0430\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 Provider <a href=\"https:\/\/pub.dev\/packages\/provider\" rel=\"nofollow\">\u0442\u0443\u0442<\/a> \u0438 <a href=\"https:\/\/flutter.dev\/docs\/development\/data-and-backend\/state-mgmt\/simple\" rel=\"nofollow\">\u0442\u0443\u0442<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043d\u0430 \u043a\u043d\u043e\u043f\u043e\u0447\u043a\u0443 \u0438\u043b\u0438 \u0441\u0432\u0430\u0439\u043f\u0435 \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u043b\u0438\u0441\u044c \u0432 Stream \u0438, \u043f\u043e\u0442\u043e\u043c, \u043d\u0430 \u0432\u0441\u0435\u0445 \u044d\u043a\u0440\u0430\u043d\u0430\u0445, \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u043b\u0438\u0441\u044c \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0436\u0435 Stream.<\/p>\n<p>  <\/p>\n<p><strong>\u041a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f BLoC<\/strong><\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043b\u0430\u0441\u0441 BLoC, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u043e\u043a\u0438, \u043d\u043e \u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0438 \u0437\u0430\u043f\u0438\u0441\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0438\u0437 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e\u0433\u043e \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430.<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">import 'dart:async'; import 'package:rxdart\/rxdart.dart'; import 'package:shared_preferences\/shared_preferences.dart';  class SwipesBloc {   Future&lt;SharedPreferences&gt; prefs = SharedPreferences.getInstance();   int _counter;    SwipesBloc() {     prefs.then((val) {       if (val.get('count') != null) {         _counter = val.getInt('count') ?? 1;       } else {         _counter = 1;       }       _actionController.stream.listen(_changeStream);       _addValue.add(_counter);     });   }    final _counterStream = BehaviorSubject&lt;int&gt;.seeded(1);    Stream get pressedCount =&gt; _counterStream.stream;   void get resetCount =&gt; _actionController.sink.add(null);   Sink get _addValue =&gt; _counterStream.sink;    StreamController _actionController = StreamController();   StreamSink get incrementCounter =&gt; _actionController.sink;    void _changeStream(data) async {     if (data == null) {       _counter = 1;     } else {       _counter = _counter + data;     }     _addValue.add(_counter);     prefs.then((val) {       val.setInt('count', _counter);     });   }    void dispose() {     _counterStream.close();     _actionController.close();   } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u043c\u044b \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u044d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441, \u0442\u043e \u0443\u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u041b\u044e\u0431\u044b\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0441\u043d\u0430\u0440\u0443\u0436\u0438 \u2014 \u0432\u0445\u043e\u0434\u044b \u0438 \u0432\u044b\u0445\u043e\u0434\u044b \u0432 Streams.<\/li>\n<li>\u0412 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435 \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043c\u044b \u043f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e\u0433\u043e \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430.<\/li>\n<li>\u0423\u0434\u043e\u0431\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u0430 \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430<\/li>\n<\/ol>\n<p>  <\/p>\n<p><strong>\u041c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u043a\u0438 \u0434\u043b\u044f \u043b\u0443\u0447\u0448\u0435\u0433\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f:<\/strong><\/p>\n<p>  <\/p>\n<ul>\n<li>\u0412\u044b\u043d\u0435\u0441\u0442\u0438 \u0438\u0437 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430 \u043a\u0443\u0441\u043e\u043a \u043a\u043e\u0434\u0430 \u0441 .then \u2014 \u043a\u0440\u0430\u0441\u0438\u0432\u0435\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434.<\/li>\n<li>\u041f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 \u0431\u0435\u0437 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430 \u043a\u0430\u043a Singleton<\/li>\n<\/ul>\n<p>  <\/p>\n<p><strong>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438<\/strong><\/p>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 Stream \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043a\u043d\u043e\u043f\u043e\u0447\u0435\u043a \u0438\u043b\u0438 \u0441\u0432\u0430\u0439\u043f\u0435 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u043a\u0430\u0440\u0442\u043e\u0447\u043a\u0435 \u0438 \u043d\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u044d\u043a\u0440\u0430\u043d\u0435.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043a\u0430\u043a \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u044f \u0432\u044b\u0431\u0440\u0430\u043b \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439, \u043c\u044b \u043e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0442\u0435 \u0447\u0430\u0441\u0442\u0438 \u0434\u0435\u0440\u0435\u0432\u0430, \u0433\u0434\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \\ \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 Consumer<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">return Scaffold(       body: Consumer&lt;SwipesBloc&gt;(         builder: (context, _swipesBloc, child) {           return StreamBuilder&lt;int&gt;(             stream: _swipesBloc.pressedCount,             builder: (context, snapshot) {               String counterValue = snapshot.data.toString();                return Stack(                 children: &lt;Widget&gt;[                   Container(<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0443 \u0438 \u0434\u0430\u043b\u0435\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445<br \/>  <code>_swipesBloc.pressedCount,<\/code><\/p>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0434\u0430\u043d\u043d\u044b\u0445<br \/>  <code>_swipesBloc.incrementCounter.add(1);<\/code><\/p>\n<p>  <\/p>\n<p>\u0412\u043e\u0442 \u0438 \u0432\u0441\u0435, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0439 \u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u043c\u044b\u0439 \u043a\u043e\u0434 \u0432 \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u0445 BLoC \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430.<\/p>\n<p>  <\/p>\n<p>\u0420\u0430\u0431\u043e\u0447\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 <a href=\"https:\/\/github.com\/awaik\/swipe_bloc_flutter\" rel=\"nofollow\">https:\/\/github.com\/awaik\/swipe_bloc_flutter<\/a><\/p>\n<p>  <\/p>\n<h2 id=\"testy\">\u0422\u0435\u0441\u0442\u044b<\/h2>\n<p>  <\/p>\n<p>\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u0432\u0438\u0434\u0436\u0435\u0442\u044b, \u043c\u043e\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u043c\u043e\u043a\u0438, \u043c\u043e\u0436\u043d\u043e e2e. <\/p>\n<p>  <\/p>\n<p>\u041c\u044b \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u043c \u0432\u0438\u0434\u0436\u0435\u0442\u044b \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u043e\u0439 \u043a\u0430\u043a \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 \u0441\u0447\u0435\u0442\u0447\u0438\u043a\u0430. \u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043f\u043e \u0442\u0435\u0441\u0442\u0430\u043c <a href=\"https:\/\/flutter.dev\/docs\/cookbook\/testing\" rel=\"nofollow\">\u0442\u0443\u0442<\/a> \u0438 <a href=\"https:\/\/habr.com\/ru\/company\/surfstudio\/blog\/468631\/\">\u0442\u0443\u0442<\/a>. <\/p>\n<p>  <\/p>\n<p><strong>\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u0438\u0434\u0436\u0435\u0442\u043e\u0432<\/strong><\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0431\u044b \u0443 \u043d\u0430\u0441 \u0431\u044b\u043b\u0438 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0442\u043e \u043c\u044b \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0442\u044c \u0432\u0441\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u0438\u0434\u0436\u0435\u0442\u043e\u0432. \u0412 \u043d\u0430\u0448\u0435\u043c \u0436\u0435 \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u0430\u043a \u0432\u0438\u0434\u0436\u0435\u0442\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438\u0441\u044c \u0438 \u043a\u0430\u043a \u043f\u0440\u043e\u0448\u043b\u0430 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f.<\/p>\n<p>  <\/p>\n<p>\u041a\u043e\u0434 <a href=\"https:\/\/github.com\/awaik\/swipe_bloc_flutter\" rel=\"nofollow\">\u0432\u043e\u0442 \u0442\u0443\u0442<\/a>, \u0432 \u043a\u043e\u0434\u0435 \u0435\u0441\u0442\u044c \u043f\u043e\u043f\u044b\u0442\u043a\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 \u0441\u0447\u0435\u0442\u0447\u0438\u043a\u0430 \u043f\u043e\u0441\u043b\u0435 \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u2014 \u0432\u044b\u0434\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0443, \u0442\u0430\u043a \u043a\u0430\u043a \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0434\u0443\u0442 \u0447\u0435\u0440\u0435\u0437 BLoC.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0442\u0435\u0441\u0442\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443<br \/>  <code>flutter test<\/code><\/p>\n<p>  <\/p>\n<p><strong>Integration tests (\u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u044b)<\/strong><\/p>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435 \u0442\u0435\u0441\u0442\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0435, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u0436\u0438\u043c\u0430\u0442\u044c \u043a\u043d\u043e\u043f\u043e\u0447\u043a\u0438, \u0441\u0432\u0430\u0439\u043f\u0430\u0442\u044c \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c 2 \u0444\u0430\u0439\u043b\u0430:<\/p>\n<p>  <\/p>\n<p>test_driver\/app.dart<br \/>  test_driver\/app_test.dart<\/p>\n<p>  <\/p>\n<p>\u0412 \u043f\u0435\u0440\u0432\u043e\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e, \u0430 \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0442\u0435\u0441\u0442\u044b. \u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u041d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f<\/li>\n<li>\u0423\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044f \u0441\u0447\u0435\u0442\u0447\u0438\u043a\u0430 \u043f\u043e\u0441\u043b\u0435 \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043a\u043d\u043e\u043f\u043e\u0447\u043a\u0438<\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"plaintext\">import 'package:flutter_driver\/flutter_driver.dart'; import 'package:test\/test.dart';  void main() {   group(     'park-flutter app',     () {       final counterTextFinder = find.byValueKey('counterKey');       final buttonFinder = find.byValueKey('incrementPlusButton');        FlutterDriver driver;       setUpAll(() async {         driver = await FlutterDriver.connect();       });        tearDownAll(() async {         if (driver != null) {           driver.close();         }       });        test('test init value', () async {         expect(await driver.getText(counterTextFinder), ^_^quot&#1;quot^_^);       });        test('test + 1 value after tapped', () async {         await driver.tap(buttonFinder);         \/\/ Then, verify the counter text is incremented by 1.         expect(await driver.getText(counterTextFinder), ^_^quot&#2;quot^_^);       });     },   ); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u043e\u0434 \u0442\u0430\u043c \u0436\u0435 <a href=\"https:\/\/github.com\/awaik\/swipe_bloc_flutterhttps:\/\/habr.com\/ru\/company\/surfstudio\/blog\/468631\/\" rel=\"nofollow\">https:\/\/github.com\/awaik\/swipe_bloc_flutter<\/a><\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0442\u0435\u0441\u0442\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443<br \/>  <code>flutter drive --target=test_driver\/app.dart<\/code><\/p>\n<p>  <\/p>\n<h2 id=\"zadacha\">\u0417\u0430\u0434\u0430\u0447\u0430.<\/h2>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0441\u0442\u043e \u0434\u043b\u044f \u0443\u0433\u043b\u0443\u0431\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f. \u0412 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445 (\u0441\u0430\u0439\u0442\u0430\u0445) \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f Debounce \u0438\u0437 ReactiveX. <\/p>\n<p>  <\/p>\n<p><strong>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/strong><\/p>\n<p>  <\/p>\n<ol>\n<li>\u0412 \u0441\u0442\u0440\u043e\u043a\u0435 \u043f\u043e\u0438\u0441\u043a\u0430 \u0432\u0432\u043e\u0434\u044f\u0442 \u0441\u043b\u043e\u0432\u043e \u0438 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0430 \u0432\u044b\u0432\u0430\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u0433\u0434\u0430 \u0437\u0430\u0437\u043e\u0440 \u043c\u0435\u0436\u0434\u0443 \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u0431\u0443\u043a\u0432 \u0431\u043e\u043b\u0435\u0435 2 \u0441\u0435\u043a\u0443\u043d\u0434<\/li>\n<li>\u041a\u043e\u0433\u0434\u0430 \u0441\u0442\u0430\u0432\u044f\u0442\u0441\u044f \u043b\u0430\u0439\u043a\u0438, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0449\u0435\u043b\u043a\u0430\u0442\u044c 10 \u0440\u0430\u0437 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443 \u2014 \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0431\u0430\u0437\u0443 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442 \u0435\u0441\u043b\u0438 \u0440\u0430\u0437\u0440\u044b\u0432 \u0432 \u0449\u0435\u043b\u043a\u0430\u043d\u044c\u044f\u0445 \u0431\u044b\u043b \u0431\u043e\u043b\u0435\u0435 2-3 \u0441\u0435\u043a\u0443\u043d\u0434<\/li>\n<li>\u2026 \u0438 \u0442.\u043f.<\/li>\n<\/ol>\n<p>  <\/p>\n<p><strong>\u0417\u0430\u0434\u0430\u0447\u0430:<\/strong> \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0447\u0442\u043e\u0431\u044b \u0446\u0438\u0444\u0440\u0430 \u043c\u0435\u043d\u044f\u043b\u0430\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u043c\u0435\u0436\u0434\u0443 \u043d\u0430\u0436\u0430\u0442\u0438\u044f\u043c\u0438 \u043d\u0430 + \u0438\u043b\u0438 \u2014 \u043f\u0440\u043e\u0448\u043b\u043e \u0431\u043e\u043b\u0435\u0435 2 \u0441\u0435\u043a\u0443\u043d\u0434. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e BLoC \u043a\u043b\u0430\u0441\u0441, \u0432\u0435\u0441\u044c \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u0434 \u0434\u043e\u043b\u0436\u0435\u043d \u043e\u0441\u0442\u0430\u0442\u044c\u0441\u044f \u0442\u0435\u043c \u0436\u0435 \u0441\u0430\u043c\u044b\u043c.<\/p>\n<p>  <\/p>\n<p>=========<\/p>\n<p>  <\/p>\n<p>\u0412\u043e\u0442 \u0438 \u0432\u0441\u0435. \u0415\u0441\u043b\u0438 \u0447\u0442\u043e-\u0442\u043e \u043a\u0440\u0438\u0432\u043e \u0438\u043b\u0438 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u043f\u043e\u043f\u0440\u0430\u0432\u043b\u044f\u0439\u0442\u0435 \u0442\u0443\u0442 \u0438\u043b\u0438 \u043d\u0430 <a href=\"https:\/\/github.com\/awaik\/swipe_bloc_flutter\" rel=\"nofollow\">github<\/a>, \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0434\u043e\u0441\u0442\u0438\u0447\u044c \u0438\u0434\u0435\u0430\u043b\u0430 \ud83d\ude42<\/p>\n<p>  <\/p>\n<p>\u0412\u0441\u0435\u043c \u0445\u043e\u0440\u043e\u0448\u0435\u0433\u043e \u043a\u043e\u0434\u0438\u043d\u0433\u0430!<\/p>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/485002\/\"> https:\/\/habr.com\/ru\/post\/485002\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/485002\/\">\n<p>\u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0432\u044b\u0440\u043e\u0441\u043b\u0430 \u0438\u0437 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u201c<a href=\"https:\/\/habr.com\/ru\/post\/475404\/\">BLoC \u043f\u0430\u0442\u0442\u0435\u0440\u043d \u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435<\/a>\u201d \u0433\u0434\u0435 \u043c\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c, \u0447\u0442\u043e \u044d\u0442\u043e \u0437\u0430 \u043f\u0430\u0442\u0442\u0435\u0440\u043d \u0438 \u043a\u0430\u043a \u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0432 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0441\u0447\u0435\u0442\u0447\u0438\u043a\u0430.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u043c \u0438 \u0434\u043b\u044f \u0441\u0432\u043e\u0435\u0433\u043e \u043b\u0443\u0447\u0448\u0435\u0433\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u044b \u043e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441\u044b:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u041a\u0430\u043a \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f BloC \u043f\u043e \u0432\u0441\u0435\u043c\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e<\/li>\n<li>\u041a\u0430\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u044b \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430<\/li>\n<li>(\u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441) \u041a\u0430\u043a \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0436\u0434\u0443 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043c\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043e\u0441\u0442\u0430\u0432\u0430\u044f\u0441\u044c \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 BLoC \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u041d\u0438\u0436\u0435 \u0430\u043d\u0438\u043c\u0430\u0448\u043a\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0435\u0433\u043e\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430, \u0430 \u043f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c \u0440\u0430\u0437\u0431\u043e\u0440 \u043f\u043e\u043b\u0435\u0442\u043e\u0432 \ud83d\ude42<\/p>\n<p>  <\/p>\n<p>\u0418 \u0435\u0449\u0451 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u043a\u0430 \u2014 \u043a\u0430\u043a \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f <a href=\"http:\/\/reactivex.io\/documentation\/operators\/debounce.html\" rel=\"nofollow\">Debounce \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0438\u0437 ReactiveX<\/a> \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430 (\u0435\u0441\u043b\u0438 \u0442\u043e\u0447\u043d\u0435\u0435, \u0442\u043e reactiveX \u2014 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 Observer pattern)<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/yi\/5d\/vd\/yi5dvd5xtr5lopselzm4tywl8ey.gif\"><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-297507","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/297507","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=297507"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/297507\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=297507"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=297507"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=297507"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}