{"id":16276,"date":"2026-03-12T13:55:16","date_gmt":"2026-03-12T05:55:16","guid":{"rendered":"http:\/\/xinyiworld.top\/wordpress_it\/?p=16276"},"modified":"2026-03-31T17:18:28","modified_gmt":"2026-03-31T09:18:28","slug":"%e6%95%b0%e6%8d%ae%e6%b5%81flow","status":"publish","type":"post","link":"http:\/\/xinyiworld.top\/wordpress_it\/?p=16276","title":{"rendered":"\u6570\u636e\u6d41Flow"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_16 counter-hierarchy counter-decimal ez-toc-grey\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\">\u76ee\u5f55<\/p>\n<span class=\"ez-toc-title-toggle\"><a class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" style=\"display: none;\"><i class=\"ez-toc-glyphicon ez-toc-icon-toggle\"><\/i><\/a><\/span><\/div>\n<nav><ul class=\"ez-toc-list ez-toc-list-level-1\"><li class=\"ez-toc-page-1 ez-toc-heading-level-1\"><a class=\"ez-toc-link ez-toc-heading-1\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=16276\/#%E4%B8%80%E3%80%81%E6%95%B0%E6%8D%AE%E6%B5%81%E5%9F%BA%E6%9C%AC%E4%BB%8B%E7%BB%8D\" title=\"\u4e00\u3001\u6570\u636e\u6d41\u57fa\u672c\u4ecb\u7ecd\">\u4e00\u3001\u6570\u636e\u6d41\u57fa\u672c\u4ecb\u7ecd<\/a><ul class=\"ez-toc-list-level-3\"><li class=\"ez-toc-heading-level-3\"><ul class=\"ez-toc-list-level-3\"><li class=\"ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-2\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=16276\/#%F0%9F%8E%AF_%E6%A0%B8%E5%BF%83%E6%A6%82%E5%BF%B5%EF%BC%9A%E5%BC%82%E6%AD%A5%E6%95%B0%E6%8D%AE%E5%BA%8F%E5%88%97\" title=\"\ud83c\udfaf \u6838\u5fc3\u6982\u5ff5\uff1a\u5f02\u6b65\u6570\u636e\u5e8f\u5217\">\ud83c\udfaf \u6838\u5fc3\u6982\u5ff5\uff1a\u5f02\u6b65\u6570\u636e\u5e8f\u5217<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-3\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=16276\/#%F0%9F%8F%97%EF%B8%8F_Flow_%E7%9A%84%E5%9F%BA%E7%9F%B3%EF%BC%9A%E5%86%B7%E6%B5%81%E4%B8%8E%E7%83%AD%E6%B5%81\" title=\"\ud83c\udfd7\ufe0f Flow \u7684\u57fa\u77f3\uff1a\u51b7\u6d41\u4e0e\u70ed\u6d41\">\ud83c\udfd7\ufe0f Flow \u7684\u57fa\u77f3\uff1a\u51b7\u6d41\u4e0e\u70ed\u6d41<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-4\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=16276\/#%E4%B8%BB%E8%A6%81_API_%E4%B8%8E%E7%94%A8%E6%B3%95%E5%85%A8%E6%99%AF%E5%9B%BE\" title=\"\u4e3b\u8981 API \u4e0e\u7528\u6cd5\u5168\u666f\u56fe\">\u4e3b\u8981 API \u4e0e\u7528\u6cd5\u5168\u666f\u56fe<\/a><ul class=\"ez-toc-list-level-4\"><li class=\"ez-toc-heading-level-4\"><a class=\"ez-toc-link ez-toc-heading-5\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=16276\/#1_%E5%88%9B%E5%BB%BA_Flow%EF%BC%9A%E4%BB%8E%E6%BA%90%E5%A4%B4%E5%BC%80%E5%A7%8B\" title=\"1. \u521b\u5efa Flow\uff1a\u4ece\u6e90\u5934\u5f00\u59cb\">1. \u521b\u5efa Flow\uff1a\u4ece\u6e90\u5934\u5f00\u59cb<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-4\"><a class=\"ez-toc-link ez-toc-heading-6\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=16276\/#2_%E4%BF%AE%E9%A5%B0_Flow%EF%BC%9A%E4%B8%AD%E9%97%B4%E8%BF%90%E7%AE%97%E7%AC%A6%EF%BC%88%E6%87%92%E5%8A%A0%E8%BD%BD%EF%BC%89\" title=\"2. \u4fee\u9970 Flow\uff1a\u4e2d\u95f4\u8fd0\u7b97\u7b26\uff08\u61d2\u52a0\u8f7d\uff09\">2. \u4fee\u9970 Flow\uff1a\u4e2d\u95f4\u8fd0\u7b97\u7b26\uff08\u61d2\u52a0\u8f7d\uff09<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-4\"><a class=\"ez-toc-link ez-toc-heading-7\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=16276\/#3_%E4%BD%BF%E7%94%A8_Flow%EF%BC%9A%E7%BB%88%E7%AB%AF%E8%BF%90%E7%AE%97%E7%AC%A6%EF%BC%88%E8%A7%A6%E5%8F%91%E6%89%A7%E8%A1%8C%EF%BC%89\" title=\"3. \u4f7f\u7528 Flow\uff1a\u7ec8\u7aef\u8fd0\u7b97\u7b26\uff08\u89e6\u53d1\u6267\u884c\uff09\">3. \u4f7f\u7528 Flow\uff1a\u7ec8\u7aef\u8fd0\u7b97\u7b26\uff08\u89e6\u53d1\u6267\u884c\uff09<\/a><\/li><\/ul><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-8\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=16276\/#%F0%9F%94%A5_%E7%8A%B6%E6%80%81%E4%B8%8E%E4%BA%8B%E4%BB%B6%EF%BC%9AStateFlow_%E5%92%8C_SharedFlow\" title=\"\ud83d\udd25 \u72b6\u6001\u4e0e\u4e8b\u4ef6\uff1aStateFlow \u548c SharedFlow\">\ud83d\udd25 \u72b6\u6001\u4e0e\u4e8b\u4ef6\uff1aStateFlow \u548c SharedFlow<\/a><ul class=\"ez-toc-list-level-4\"><li class=\"ez-toc-heading-level-4\"><a class=\"ez-toc-link ez-toc-heading-9\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=16276\/#StateFlow%EF%BC%9A%E7%8A%B6%E6%80%81%E5%AE%B9%E5%99%A8\" title=\"StateFlow\uff1a\u72b6\u6001\u5bb9\u5668\">StateFlow\uff1a\u72b6\u6001\u5bb9\u5668<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-4\"><a class=\"ez-toc-link ez-toc-heading-10\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=16276\/#SharedFlow%EF%BC%9A%E4%BA%8B%E4%BB%B6%E6%80%BB%E7%BA%BF\" title=\"SharedFlow\uff1a\u4e8b\u4ef6\u603b\u7ebf\">SharedFlow\uff1a\u4e8b\u4ef6\u603b\u7ebf<\/a><\/li><\/ul><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-11\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=16276\/#%F0%9F%93%B1_%E4%B8%8E_Android_%E6%9E%B6%E6%9E%84%E7%BB%84%E4%BB%B6%E9%9B%86%E6%88%90\" title=\"\ud83d\udcf1 \u4e0e Android \u67b6\u6784\u7ec4\u4ef6\u96c6\u6210\">\ud83d\udcf1 \u4e0e Android \u67b6\u6784\u7ec4\u4ef6\u96c6\u6210<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-12\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=16276\/#%F0%9F%92%A1_%E6%A0%B8%E5%BF%83%E8%A6%81%E7%82%B9%E4%B8%8E%E6%9C%80%E4%BD%B3%E5%AE%9E%E8%B7%B5\" title=\"\ud83d\udca1 \u6838\u5fc3\u8981\u70b9\u4e0e\u6700\u4f73\u5b9e\u8df5\">\ud83d\udca1 \u6838\u5fc3\u8981\u70b9\u4e0e\u6700\u4f73\u5b9e\u8df5<\/a><\/li><\/ul><\/li><\/ul><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-1\"><a class=\"ez-toc-link ez-toc-heading-13\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=16276\/#%E4%BA%8C%E3%80%81MutableStateFlow\" title=\"\u4e8c\u3001MutableStateFlow\">\u4e8c\u3001MutableStateFlow<\/a><ul class=\"ez-toc-list-level-2\"><li class=\"ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-14\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=16276\/#1Flow%EF%BC%9A%E6%9C%80%E5%9F%BA%E6%9C%AC%E7%9A%84%E6%95%B0%E6%8D%AE%E6%B5%81\" title=\"1.Flow\uff1a\u6700\u57fa\u672c\u7684\u6570\u636e\u6d41\">1.Flow\uff1a\u6700\u57fa\u672c\u7684\u6570\u636e\u6d41<\/a><ul class=\"ez-toc-list-level-3\"><li class=\"ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-15\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=16276\/#%E4%BB%80%E4%B9%88%E6%98%AF_Flow%EF%BC%9F\" title=\"\u4ec0\u4e48\u662f Flow\uff1f\">\u4ec0\u4e48\u662f Flow\uff1f<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-16\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=16276\/#Flow_%E7%9A%84%E9%87%8D%E8%A6%81%E7%89%B9%E7%82%B9%EF%BC%9A%E5%86%B7%E6%B5%81\" title=\"Flow \u7684\u91cd\u8981\u7279\u70b9\uff1a\u51b7\u6d41\">Flow \u7684\u91cd\u8981\u7279\u70b9\uff1a\u51b7\u6d41<\/a><\/li><\/ul><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-17\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=16276\/#2%E9%97%AE%E9%A2%98%EF%BC%9A%E8%83%BD%E4%B8%8D%E8%83%BD%E6%9C%89%E4%B8%AA%E6%B0%B8%E4%B9%85%E7%9A%84%E6%95%B0%E6%8D%AE%E6%B5%81%EF%BC%9F\" title=\"2.\u95ee\u9898\uff1a\u80fd\u4e0d\u80fd\u6709\u4e2a\u201c\u6c38\u4e45\u7684\u201d\u6570\u636e\u6d41\uff1f\">2.\u95ee\u9898\uff1a\u80fd\u4e0d\u80fd\u6709\u4e2a\u201c\u6c38\u4e45\u7684\u201d\u6570\u636e\u6d41\uff1f<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-18\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=16276\/#3SharedFlow%EF%BC%9A%E5%85%B1%E4%BA%AB%E7%9A%84%E6%95%B0%E6%8D%AE%E6%B5%81\" title=\"3.SharedFlow\uff1a\u5171\u4eab\u7684\u6570\u636e\u6d41\">3.SharedFlow\uff1a\u5171\u4eab\u7684\u6570\u636e\u6d41<\/a><ul class=\"ez-toc-list-level-3\"><li class=\"ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-19\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=16276\/#SharedFlow_%E7%9A%84%E7%89%B9%E7%82%B9%EF%BC%9A%E7%83%AD%E6%B5%81\" title=\"SharedFlow \u7684\u7279\u70b9\uff1a\u70ed\u6d41\">SharedFlow \u7684\u7279\u70b9\uff1a\u70ed\u6d41<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-20\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=16276\/#%E7%B1%BB%E6%AF%94\" title=\"\u7c7b\u6bd4\">\u7c7b\u6bd4<\/a><\/li><\/ul><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-21\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=16276\/#4StateFlow%EF%BC%9A%E7%89%B9%E6%AE%8A%E7%9A%84_SharedFlow\" title=\"4.StateFlow\uff1a\u7279\u6b8a\u7684 SharedFlow\">4.StateFlow\uff1a\u7279\u6b8a\u7684 SharedFlow<\/a><ul class=\"ez-toc-list-level-3\"><li class=\"ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-22\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=16276\/#StateFlow_%E7%9A%84%E7%89%B9%E6%AE%8A%E4%B9%8B%E5%A4%84\" title=\"StateFlow \u7684\u7279\u6b8a\u4e4b\u5904\">StateFlow \u7684\u7279\u6b8a\u4e4b\u5904<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-23\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=16276\/#%E4%BB%A3%E7%A0%81%E7%A4%BA%E4%BE%8B\" title=\"\u4ee3\u7801\u793a\u4f8b\">\u4ee3\u7801\u793a\u4f8b<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-24\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=16276\/#%E4%B8%BA%E4%BB%80%E4%B9%88%E8%A6%81%E6%9C%89_StateFlow%EF%BC%9F\" title=\"\u4e3a\u4ec0\u4e48\u8981\u6709 StateFlow\uff1f\">\u4e3a\u4ec0\u4e48\u8981\u6709 StateFlow\uff1f<\/a><\/li><\/ul><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-25\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=16276\/#5Mutable_%E5%89%8D%E7%BC%80%E7%9A%84%E5%90%AB%E4%B9%89\" title=\"5.Mutable \u524d\u7f00\u7684\u542b\u4e49\">5.Mutable \u524d\u7f00\u7684\u542b\u4e49<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-26\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=16276\/#6%E5%85%B3%E7%B3%BB%E6%80%BB%E7%BB%93%E5%9B%BE\" title=\"6.\u5173\u7cfb\u603b\u7ed3\u56fe\">6.\u5173\u7cfb\u603b\u7ed3\u56fe<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-27\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=16276\/#7%E4%BB%80%E4%B9%88%E6%97%B6%E5%80%99%E7%94%A8%E5%93%AA%E4%B8%AA%EF%BC%9F\" title=\"7.\u4ec0\u4e48\u65f6\u5019\u7528\u54ea\u4e2a\uff1f\">7.\u4ec0\u4e48\u65f6\u5019\u7528\u54ea\u4e2a\uff1f<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-2\"><a class=\"ez-toc-link ez-toc-heading-28\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=16276\/#8%E4%B8%80%E4%B8%AA%E5%AE%8C%E6%95%B4%E7%9A%84%E4%BE%8B%E5%AD%90\" title=\"8.\u4e00\u4e2a\u5b8c\u6574\u7684\u4f8b\u5b50\">8.\u4e00\u4e2a\u5b8c\u6574\u7684\u4f8b\u5b50<\/a><\/li><\/ul><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-1\"><a class=\"ez-toc-link ez-toc-heading-29\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=16276\/#%E4%B8%89%E3%80%81repeatOnLifecycle_%E6%88%96_shareIn\" title=\"\u4e09\u3001repeatOnLifecycle \u6216 shareIn\">\u4e09\u3001repeatOnLifecycle \u6216 shareIn<\/a><ul class=\"ez-toc-list-level-3\"><li class=\"ez-toc-heading-level-3\"><ul class=\"ez-toc-list-level-3\"><li class=\"ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-30\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=16276\/#%F0%9F%86%9A_%E6%A0%B8%E5%BF%83%E5%8C%BA%E5%88%AB%E4%B8%8E%E8%81%94%E7%B3%BB\" title=\"\ud83c\udd9a \u6838\u5fc3\u533a\u522b\u4e0e\u8054\u7cfb\">\ud83c\udd9a \u6838\u5fc3\u533a\u522b\u4e0e\u8054\u7cfb<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-3\"><a class=\"ez-toc-link ez-toc-heading-31\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=16276\/#%F0%9F%92%A1_%E5%8D%8F%E5%90%8C%E5%B7%A5%E4%BD%9C%E6%A8%A1%E5%BC%8F\" title=\"\ud83d\udca1 \u534f\u540c\u5de5\u4f5c\u6a21\u5f0f\">\ud83d\udca1 \u534f\u540c\u5de5\u4f5c\u6a21\u5f0f<\/a><\/li><\/ul><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h1><span class=\"ez-toc-section\" id=\"%E4%B8%80%E3%80%81%E6%95%B0%E6%8D%AE%E6%B5%81%E5%9F%BA%E6%9C%AC%E4%BB%8B%E7%BB%8D\"><\/span>\u4e00\u3001\u6570\u636e\u6d41\u57fa\u672c\u4ecb\u7ecd<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>\u57fa\u4e8e\u534f\u7a0b\u7684\u6570\u636e\u6d41\u5904\u7406\u6846\u67b6<\/p>\n<h3><span class=\"ez-toc-section\" id=\"%F0%9F%8E%AF_%E6%A0%B8%E5%BF%83%E6%A6%82%E5%BF%B5%EF%BC%9A%E5%BC%82%E6%AD%A5%E6%95%B0%E6%8D%AE%E5%BA%8F%E5%88%97\"><\/span>\ud83c\udfaf \u6838\u5fc3\u6982\u5ff5\uff1a\u5f02\u6b65\u6570\u636e\u5e8f\u5217<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Flow \u662f\u4e00\u79cd<strong>\u53ef\u4ee5\u5f02\u6b65\u53d1\u51fa\u591a\u4e2a\u503c<\/strong>\u7684\u6570\u636e\u6d41\uff0c\u8fd9\u4f7f\u5b83\u533a\u522b\u4e8e\u4ec5\u8fd4\u56de\u5355\u4e2a\u503c\u7684\u6302\u8d77\u51fd\u6570\u3002\u5b83\u4e3b\u8981\u7531\u4e09\u4e2a\u5b9e\u4f53\u6784\u6210\uff1a<\/p>\n<ul>\n<li><strong>\u63d0\u4f9b\u65b9<\/strong>\uff1a\u8d1f\u8d23\u751f\u6210\u5e76\u6dfb\u52a0\u6570\u636e\u5230\u6d41\u4e2d\u3002<\/li>\n<li><strong>\u4e2d\u4ecb<\/strong>\uff1a\uff08\u53ef\u9009\uff09\u8d1f\u8d23\u4fee\u6539\u53d1\u9001\u5230\u6d41\u4e2d\u7684\u503c\u6216\u6d41\u672c\u8eab\u3002<\/li>\n<li><strong>\u4f7f\u7528\u65b9<\/strong>\uff1a\u8d1f\u8d23\u63a5\u6536\u548c\u4f7f\u7528\u6d41\u4e2d\u7684\u503c\u3002<\/li>\n<\/ul>\n<h3><span class=\"ez-toc-section\" id=\"%F0%9F%8F%97%EF%B8%8F_Flow_%E7%9A%84%E5%9F%BA%E7%9F%B3%EF%BC%9A%E5%86%B7%E6%B5%81%E4%B8%8E%E7%83%AD%E6%B5%81\"><\/span>\ud83c\udfd7\ufe0f Flow \u7684\u57fa\u77f3\uff1a\u51b7\u6d41\u4e0e\u70ed\u6d41<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\u7406\u89e3 <strong>\u51b7\u6d41<\/strong> \u548c <strong>\u70ed\u6d41<\/strong> \u7684\u533a\u522b\u81f3\u5173\u91cd\u8981\uff1a<\/p>\n<ul>\n<li><strong>\u51b7\u6d41 (\u5982 <code>flow<\/code> \u6784\u5efa\u5668)<\/strong>\uff1a<strong>\u65e0\u72b6\u6001<\/strong>\uff0c<strong>\u6bcf\u6b21<\/strong> \u5f53\u6709\u4f7f\u7528\u65b9\uff08\u8c03\u7528 <code>collect<\/code>\uff09\u65f6\uff0c\u63d0\u4f9b\u65b9\u7684\u4ee3\u7801\u5c31\u4f1a<strong>\u91cd\u65b0\u6267\u884c<\/strong>\u3002\u5b83\u4e0d\u5b58\u50a8\u6570\u636e\u3002<\/li>\n<li><strong>\u70ed\u6d41 (\u5982 <code>StateFlow<\/code>\/<code>SharedFlow<\/code>)<\/strong>\uff1a<strong>\u6709\u72b6\u6001<\/strong>\uff0c\u72ec\u7acb\u4e8e\u6536\u96c6\u64cd\u4f5c\u800c\u5b58\u5728\uff0c\u6570\u636e\u4f1a\u88ab<strong>\u7f13\u5b58<\/strong>\u3002\u591a\u4e2a\u4f7f\u7528\u65b9\u53ef\u4ee5\u5171\u4eab\u540c\u4e00\u4e2a\u70ed\u6d41\u5b9e\u4f8b\u5e76\u63a5\u6536\u6570\u636e\uff0c\u4e14\u6536\u96c6\u4e0d\u4f1a\u89e6\u53d1\u63d0\u4f9b\u65b9\u4ee3\u7801\u3002<\/li>\n<\/ul>\n<h3><span class=\"ez-toc-section\" id=\"%E4%B8%BB%E8%A6%81_API_%E4%B8%8E%E7%94%A8%E6%B3%95%E5%85%A8%E6%99%AF%E5%9B%BE\"><\/span>\u4e3b\u8981 API \u4e0e\u7528\u6cd5\u5168\u666f\u56fe<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<h4><span class=\"ez-toc-section\" id=\"1_%E5%88%9B%E5%BB%BA_Flow%EF%BC%9A%E4%BB%8E%E6%BA%90%E5%A4%B4%E5%BC%80%E5%A7%8B\"><\/span>1. \u521b\u5efa Flow\uff1a\u4ece\u6e90\u5934\u5f00\u59cb<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<ul>\n<li><strong><code>flow { ... }<\/code> \u6784\u5efa\u5668<\/strong>\uff1a\u6700\u5e38\u7528\u7684\u65b9\u5f0f\u3002\u5728\u4ee3\u7801\u5757\u4e2d\u901a\u8fc7 <code>emit(value)<\/code> \u53d1\u51fa\u6570\u636e\u3002<\/li>\n<li><strong><code>flowOf(...)<\/code><\/strong>\uff1a\u57fa\u4e8e\u4e00\u7ec4\u56fa\u5b9a\u7684\u503c\u521b\u5efa Flow\u3002<\/li>\n<li><strong><code>.asFlow()<\/code><\/strong>\uff1a\u5c06\u5404\u79cd\u96c6\u5408\uff08\u5982 <code>List<\/code>\u3001<code>Set<\/code>\uff09\u6216\u5e8f\u5217\u8f6c\u6362\u4e3a Flow\u3002<\/li>\n<li><strong><code>callbackFlow { ... }<\/code><\/strong>\uff1a<strong>\u5173\u952e\u5de5\u5177<\/strong>\u3002\u7528\u4e8e\u5c06\u57fa\u4e8e\u56de\u8c03\u7684 API\uff08\u5982 Firebase Listener\uff09\u8f6c\u6362\u4e3a Flow\u3002\u9700\u5728 <code>awaitClose { }<\/code> \u4e2d\u6e05\u7406\u8d44\u6e90\u3002<\/li>\n<\/ul>\n<h4><span class=\"ez-toc-section\" id=\"2_%E4%BF%AE%E9%A5%B0_Flow%EF%BC%9A%E4%B8%AD%E9%97%B4%E8%BF%90%E7%AE%97%E7%AC%A6%EF%BC%88%E6%87%92%E5%8A%A0%E8%BD%BD%EF%BC%89\"><\/span>2. \u4fee\u9970 Flow\uff1a\u4e2d\u95f4\u8fd0\u7b97\u7b26\uff08\u61d2\u52a0\u8f7d\uff09<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>\u8fd9\u4e9b\u8fd0\u7b97\u7b26\u5e94\u7528\u4e8e Flow \u540e\uff0c\u4f1a\u8fd4\u56de\u4e00\u4e2a\u65b0\u7684 Flow\uff0c\u5e76\u5b9a\u4e49\u6570\u636e\u8f6c\u6362\u7684\u903b\u8f91\uff0c\u4f46<strong>\u4e0d\u4f1a\u7acb\u5373\u6267\u884c<\/strong>\uff0c\u76f4\u5230\u6709\u7ec8\u7aef\u8fd0\u7b97\u7b26\u5f00\u59cb\u6536\u96c6\u3002<\/p>\n<ul>\n<li><strong>\u8f6c\u6362<\/strong>\uff1a<code>map<\/code>\u3001<code>transform<\/code>\uff08\u53ef\u591a\u6b21 <code>emit<\/code>\uff09\u3002<\/li>\n<li><strong>\u8fc7\u6ee4<\/strong>\uff1a<code>filter<\/code>\u3001<code>take<\/code>\u3001<code>drop<\/code>\u3001<code>distinctUntilChanged<\/code>\u3002<\/li>\n<li><strong>\u7ec4\u5408<\/strong>\uff1a\n<ul>\n<li><code>zip<\/code>\uff1a\u5c06\u4e24\u4e2a Flow \u4e25\u683c<strong>\u914d\u5bf9<\/strong>\uff0c\u4ee5\u8f83\u77ed\u7684 Flow \u4e3a\u51c6\u7ed3\u675f\u3002<\/li>\n<li><code>combine<\/code>\uff1a\u5f53 Flow \u4e2d<strong>\u4efb\u610f\u4e00\u4e2a<\/strong>\u6709\u65b0\u503c\u65f6\uff0c\u7528\u5404\u81ea\u7684\u6700\u65b0\u503c\u8fdb\u884c\u7ec4\u5408\u3002<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u5904\u7406\u80cc\u538b\u4e0e\u6027\u80fd<\/strong>\uff1a\n<ul>\n<li><code>buffer()<\/code>\uff1a\u4e3a Flow \u6dfb\u52a0\u7f13\u51b2\u533a\uff0c\u5141\u8bb8\u751f\u4ea7\u8005\u4e0e\u6d88\u8d39\u8005<strong>\u5e76\u884c\u8fd0\u884c<\/strong>\uff0c\u4f18\u5316\u6574\u4f53\u6267\u884c\u65f6\u95f4\u3002<\/li>\n<li><code>conflate()<\/code>\uff1a\u4ec5\u4fdd\u7559\u6700\u65b0\u7684\u503c\uff0c\u5f53\u6d88\u8d39\u8005\u5904\u7406\u901f\u5ea6\u6162\u65f6\uff0c\u4e2d\u95f4\u503c\u4f1a\u88ab\u4e22\u5f03\u3002<\/li>\n<li><code>collectLatest<\/code>\uff1a\u5f53\u6709\u65b0\u503c\u53d1\u51fa\u65f6\uff0c\u5982\u679c\u65e7\u503c\u8fd8\u672a\u5904\u7406\u5b8c\uff0c\u5219<strong>\u53d6\u6d88<\/strong>\u65e7\u503c\u7684\u5904\u7406\u3002<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u7ebf\u7a0b\u5207\u6362<\/strong>\uff1a<code>flowOn(Dispatcher)<\/code>\uff1a\u6539\u53d8<strong>\u4e0a\u6e38<\/strong>\uff08<code>flowOn<\/code>\u4e4b\u524d\u7684\u90e8\u5206\uff09\u6267\u884c\u7684\u534f\u7a0b\u8c03\u5ea6\u5668\u3002<\/li>\n<li><strong>\u9519\u8bef\u5904\u7406<\/strong>\uff1a<code>catch { ... }<\/code>\uff1a\u6355\u83b7\u4e0a\u6e38\u5f02\u5e38\uff0c\u53ef <code>emit<\/code> \u5907\u7528\u503c\u6216\u91cd\u65b0\u629b\u51fa\u3002<\/li>\n<li><strong>\u526f\u4f5c\u7528<\/strong>\uff1a<code>onEach<\/code>\u3001<code>onStart<\/code>\u3001<code>onCompletion<\/code>\uff1a\u7528\u4e8e\u76d1\u542c Flow \u7684\u751f\u547d\u5468\u671f\u4e8b\u4ef6\uff0c\u4e0d\u5f71\u54cd\u6570\u636e\u672c\u8eab\u3002<\/li>\n<\/ul>\n<h4><span class=\"ez-toc-section\" id=\"3_%E4%BD%BF%E7%94%A8_Flow%EF%BC%9A%E7%BB%88%E7%AB%AF%E8%BF%90%E7%AE%97%E7%AC%A6%EF%BC%88%E8%A7%A6%E5%8F%91%E6%89%A7%E8%A1%8C%EF%BC%89\"><\/span>3. \u4f7f\u7528 Flow\uff1a\u7ec8\u7aef\u8fd0\u7b97\u7b26\uff08\u89e6\u53d1\u6267\u884c\uff09<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>\u7ec8\u7aef\u8fd0\u7b97\u7b26\u662f<strong>\u6302\u8d77\u51fd\u6570<\/strong>\uff0c\u8c03\u7528\u540e\u4f1a\u542f\u52a8 Flow \u5e76\u5f00\u59cb\u63a5\u6536\u6570\u636e\u3002<\/p>\n<ul>\n<li><strong><code>collect { ... }<\/code><\/strong>\uff1a\u6700\u57fa\u7840\u7684\uff0c\u9010\u4e2a\u5904\u7406\u6bcf\u4e2a\u503c\u3002<\/li>\n<li><strong>\u8f6c\u6362\u4e3a\u5176\u4ed6\u7c7b\u578b<\/strong>\uff1a<code>toList()<\/code>\u3001<code>toSet()<\/code>\u3002<\/li>\n<li><strong>\u83b7\u53d6\u7279\u5b9a\u503c<\/strong>\uff1a<code>first()<\/code>\u3001<code>single()<\/code>\u3002<\/li>\n<li><strong>\u89c4\u7ea6\u64cd\u4f5c<\/strong>\uff1a<code>reduce()<\/code>\u3001<code>fold()<\/code>\u3002<\/li>\n<li><strong>\u5224\u65ad\u4e0e\u8ba1\u6570<\/strong>\uff1a<code>any()<\/code>\u3001<code>count()<\/code>\u3002<\/li>\n<\/ul>\n<h3><span class=\"ez-toc-section\" id=\"%F0%9F%94%A5_%E7%8A%B6%E6%80%81%E4%B8%8E%E4%BA%8B%E4%BB%B6%EF%BC%9AStateFlow_%E5%92%8C_SharedFlow\"><\/span>\ud83d\udd25 \u72b6\u6001\u4e0e\u4e8b\u4ef6\uff1aStateFlow \u548c SharedFlow<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\u5b83\u4eec\u662f\u70ed\u6d41\uff0c\u975e\u5e38\u9002\u5408\u5728 ViewModel \u4e2d\u5411\u754c\u9762\u66b4\u9732\u72b6\u6001\u6216\u4e8b\u4ef6\u3002<\/p>\n<h4><span class=\"ez-toc-section\" id=\"StateFlow%EF%BC%9A%E7%8A%B6%E6%80%81%E5%AE%B9%E5%99%A8\"><\/span>StateFlow\uff1a\u72b6\u6001\u5bb9\u5668<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<ul>\n<li><strong>\u7279\u70b9<\/strong>\uff1a\u603b\u662f\u6301\u6709<strong>\u4e00\u4e2a\u6700\u65b0\u72b6\u6001<\/strong>\u3002\u65b0\u6536\u96c6\u5668\u4f1a\u7acb\u5373\u6536\u5230\u5f53\u524d\u7684\u6700\u65b0\u72b6\u6001\u3002\u7c7b\u4f3c\u4e8e LiveData\uff0c\u4f46\u9700\u8981\u914d\u5408 <code>repeatOnLifecycle<\/code> \u5728\u754c\u9762\u5c42\u5b89\u5168\u6536\u96c6\u3002<\/li>\n<li><strong>\u4f7f\u7528\u6a21\u5f0f<\/strong>\uff1a\u5728 ViewModel \u4e2d\uff0c\u901a\u5e38\u4f7f\u7528\u79c1\u6709\u7684 <code>MutableStateFlow<\/code> \u4f5c\u4e3a\u540e\u5907\u5c5e\u6027\uff0c\u5bf9\u5916\u66b4\u9732\u4e0d\u53ef\u53d8\u7684 <code>StateFlow<\/code>\u3002\u901a\u8fc7\u66f4\u65b0\u5176 <code>value<\/code> \u6765\u53d1\u9001\u65b0\u72b6\u6001\u3002<\/li>\n<li><strong>\u8f6c\u6362\u5de5\u5177<\/strong>\uff1a<code>.stateIn<\/code> \u53ef\u4ee5\u5c06\u666e\u901a Flow \u6216 SharedFlow \u8f6c\u6362\u4e3a StateFlow\uff0c\u9700\u8981\u6307\u5b9a\u4f5c\u7528\u57df\u3001\u521d\u59cb\u503c\u548c\u542f\u52a8\u7b56\u7565\u3002<\/li>\n<\/ul>\n<h4><span class=\"ez-toc-section\" id=\"SharedFlow%EF%BC%9A%E4%BA%8B%E4%BB%B6%E6%80%BB%E7%BA%BF\"><\/span>SharedFlow\uff1a\u4e8b\u4ef6\u603b\u7ebf<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<ul>\n<li><strong>\u7279\u70b9<\/strong>\uff1a\u662f StateFlow \u7684\u6cdb\u5316\u7248\u672c\uff0c<strong>\u53ef\u9ad8\u5ea6\u914d\u7f6e<\/strong>\u3002\u9002\u5408\u53d1\u9001\u4e00\u6b21\u6027\u4e8b\u4ef6\uff08\u5982\u5bfc\u822a\u3001Snackbar \u6d88\u606f\uff09\u6216\u9700\u8981\u591a\u4e2a\u8ba2\u9605\u8005\u5171\u4eab\u7684\u6570\u636e\u6d41\u3002<\/li>\n<li><strong>\u6838\u5fc3\u53c2\u6570<\/strong>\uff1a\n<ul>\n<li><code>replay<\/code>\uff1a\u4e3a\u65b0\u8ba2\u9605\u8005<strong>\u91cd\u653e<\/strong>\u4e4b\u524d\u53d1\u51fa\u7684 N \u4e2a\u503c\u3002<\/li>\n<li><code>extraBufferCapacity<\/code>\uff1a\u9664\u4e86\u91cd\u653e\u7f13\u5b58\u5916\u7684\u989d\u5916\u7f13\u51b2\u533a\u5927\u5c0f\u3002<\/li>\n<li><code>onBufferOverflow<\/code>\uff1a\u7f13\u51b2\u533a\u6ee1\u65f6\u7684\u7b56\u7565\uff08\u6302\u8d77\u3001\u4e22\u5f03\u6700\u65b0\u3001\u4e22\u5f03\u6700\u65e7\uff09\u3002<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u8f6c\u6362\u5de5\u5177<\/strong>\uff1a<code>.shareIn<\/code> \u53ef\u4ee5\u5c06\u666e\u901a Flow \u8f6c\u6362\u4e3a SharedFlow\uff0c\u9700\u8981\u6307\u5b9a\u4f5c\u7528\u57df\u3001\u91cd\u653e\u6570\u91cf\u548c\u542f\u52a8\u7b56\u7565\u3002<\/li>\n<\/ul>\n<h3><span class=\"ez-toc-section\" id=\"%F0%9F%93%B1_%E4%B8%8E_Android_%E6%9E%B6%E6%9E%84%E7%BB%84%E4%BB%B6%E9%9B%86%E6%88%90\"><\/span>\ud83d\udcf1 \u4e0e Android \u67b6\u6784\u7ec4\u4ef6\u96c6\u6210<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<ul>\n<li><strong>Room<\/strong>\uff1a\u5728 DAO \u4e2d\uff0c\u8ba9\u67e5\u8be2\u51fd\u6570\u8fd4\u56de <code>Flow&lt;T&gt;<\/code>\uff0c\u5373\u53ef\u5728\u6570\u636e\u5e93\u53d8\u66f4\u65f6\u81ea\u52a8\u6536\u5230\u6700\u65b0\u6570\u636e\u3002<\/li>\n<li><strong>ViewModel<\/strong>\uff1a\n<ul>\n<li>\u4f7f\u7528 <code>viewModelScope<\/code> \u542f\u52a8\u534f\u7a0b\u6765\u6536\u96c6\u6570\u636e\u6e90\u6216\u6267\u884c\u64cd\u4f5c\u3002<\/li>\n<li>\u4f7f\u7528 <code>StateFlow<\/code> \u66b4\u9732\u754c\u9762\u72b6\u6001\uff0c\u786e\u4fdd\u72b6\u6001\u5728\u914d\u7f6e\u53d8\u66f4\u540e\u4f9d\u7136\u5b58\u6d3b\u3002<\/li>\n<li>\u5728\u754c\u9762\u5c42\u4f7f\u7528 <code>repeatOnLifecycle(Lifecycle.State.STARTED)<\/code> \u6765\u5b89\u5168\u5730\u6536\u96c6 Flow\uff0c\u907f\u514d\u8d44\u6e90\u6d6a\u8d39\u548c\u5185\u5b58\u6cc4\u6f0f\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3><span class=\"ez-toc-section\" id=\"%F0%9F%92%A1_%E6%A0%B8%E5%BF%83%E8%A6%81%E7%82%B9%E4%B8%8E%E6%9C%80%E4%BD%B3%E5%AE%9E%E8%B7%B5\"><\/span>\ud83d\udca1 \u6838\u5fc3\u8981\u70b9\u4e0e\u6700\u4f73\u5b9e\u8df5<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<ol>\n<li><strong>\u51b7\u70ed\u6d41\u9009\u62e9<\/strong>\uff1a\u5bf9\u4e8e\u6bcf\u6b21\u6536\u96c6\u90fd\u9700\u8981\u72ec\u7acb\u8ba1\u7b97\u7684\u573a\u666f\uff0c\u7528<strong>\u51b7\u6d41<\/strong>\uff1b\u5bf9\u4e8e\u9700\u8981\u5171\u4eab\u72b6\u6001\u6216\u4e8b\u4ef6\u7684\u573a\u666f\uff0c\u7528<strong>\u70ed\u6d41<\/strong>\uff08<code>StateFlow<\/code>\/<code>SharedFlow<\/code>\uff09\u3002<\/li>\n<li><strong>\u5f02\u5e38\u5904\u7406<\/strong>\uff1a\u59cb\u7ec8\u5728 Flow \u94fe\u7684\u9002\u5f53\u4f4d\u7f6e\u4f7f\u7528 <code>catch<\/code> \u8fd0\u7b97\u7b26\u6765\u5904\u7406\u5f02\u5e38\uff0c\u5e76\u8003\u8651\u662f\u5426\u8981\u53d1\u51fa\u4e00\u4e2a\u5907\u7528\u503c\u3002<\/li>\n<li><strong>\u7ebf\u7a0b\u7ba1\u7406<\/strong>\uff1a\u4f7f\u7528 <code>flowOn<\/code> \u5c06\u8017\u65f6\u64cd\u4f5c\uff08\u5982\u7f51\u7edc\u8bf7\u6c42\u3001\u6570\u636e\u5e93\u8bfb\u5199\uff09\u5207\u6362\u5230\u540e\u53f0\u8c03\u5ea6\u5668\uff0c\u4fdd\u6301\u754c\u9762\u7ebf\u7a0b\u6d41\u7545\u3002<\/li>\n<li><strong>\u80cc\u538b\u5904\u7406<\/strong>\uff1a\u5f53\u751f\u4ea7\u8005\u901f\u5ea6\u53ef\u80fd\u5feb\u4e8e\u6d88\u8d39\u8005\u65f6\uff0c\u6839\u636e\u4e1a\u52a1\u9700\u6c42\u9009\u62e9 <code>buffer<\/code>\u3001<code>conflate<\/code> \u6216 <code>collectLatest<\/code>\u3002<\/li>\n<li><strong>\u8d44\u6e90\u91ca\u653e<\/strong>\uff1a\u5728\u81ea\u5b9a\u4e49\u7684 <code>callbackFlow<\/code> \u4e2d\uff0c\u52a1\u5fc5\u5728 <code>awaitClose { }<\/code> \u4e2d\u6e05\u7406\u56de\u8c03\u76d1\u542c\u5668\uff0c\u9632\u6b62\u5185\u5b58\u6cc4\u6f0f\u3002<\/li>\n<\/ol>\n<h1><span class=\"ez-toc-section\" id=\"%E4%BA%8C%E3%80%81MutableStateFlow\"><\/span>\u4e8c\u3001MutableStateFlow<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>\u597d\u7684\uff0c\u6211\u4eec\u4ece\u6700\u57fa\u7840\u7684 <code>Flow<\/code> \u5f00\u59cb\uff0c\u4e00\u6b65\u6b65\u8bb2\u5230 <code>StateFlow<\/code>\uff0c\u8fd9\u6837\u4f60\u5c31\u80fd\u7406\u89e3\u5b83\u4eec\u4e4b\u95f4\u7684\u5173\u7cfb\u4e86\u3002<\/p>\n<h2><span class=\"ez-toc-section\" id=\"1Flow%EF%BC%9A%E6%9C%80%E5%9F%BA%E6%9C%AC%E7%9A%84%E6%95%B0%E6%8D%AE%E6%B5%81\"><\/span>1.Flow\uff1a\u6700\u57fa\u672c\u7684\u6570\u636e\u6d41<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><span class=\"ez-toc-section\" id=\"%E4%BB%80%E4%B9%88%E6%98%AF_Flow%EF%BC%9F\"><\/span>\u4ec0\u4e48\u662f Flow\uff1f<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Flow \u5c31\u50cf\u4e00\u4e2a<strong>\u53ef\u4ee5\u591a\u6b21\u53d1\u9001\u6570\u636e\u7684\u201c\u7ba1\u9053\u201d<\/strong>\uff0c\u4f60\u53ef\u4ee5\u5f80\u91cc\u9762\u653e\u6570\u636e\uff0c\u522b\u4eba\u53ef\u4ee5\u4ece\u53e6\u4e00\u5934\u63a5\u6536\u6570\u636e\u3002<\/p>\n<p>kotlin<\/p>\n<pre><code>\/\/ \u521b\u5efa\u4e00\u4e2a Flow\uff08\u7ba1\u9053\uff09\nval numberFlow = flow {\n    emit(1)  \/\/ \u5f80\u7ba1\u9053\u91cc\u653e 1\n    emit(2)  \/\/ \u653e 2\n    emit(3)  \/\/ \u653e 3\n}\n\n\/\/ \u4ece\u7ba1\u9053\u91cc\u63a5\u6536\u6570\u636e\nnumberFlow.collect { number -&gt;\n    println(number)  \/\/ \u4f1a\u6253\u5370 1, 2, 3\n}<\/code><\/pre>\n<h3><span class=\"ez-toc-section\" id=\"Flow_%E7%9A%84%E9%87%8D%E8%A6%81%E7%89%B9%E7%82%B9%EF%BC%9A%E5%86%B7%E6%B5%81\"><\/span>Flow \u7684\u91cd\u8981\u7279\u70b9\uff1a<strong>\u51b7\u6d41<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\u6bcf\u6b21\u8c03\u7528 <code>collect<\/code>\uff0c\u90fd\u4f1a<strong>\u91cd\u65b0\u6267\u884c<\/strong>\u4e00\u904d <code>flow {}<\/code> \u91cc\u9762\u7684\u4ee3\u7801\uff1a<\/p>\n<p>kotlin<\/p>\n<pre><code>val numberFlow = flow {\n    println(&quot;\u5f00\u59cb\u6267\u884c&quot;)\n    emit(1)\n}\n\n\/\/ \u7b2c\u4e00\u6b21\u6536\u96c6\nnumberFlow.collect { println(&quot;\u6536\u5230: $it&quot;) }  \n\/\/ \u8f93\u51fa\uff1a\u5f00\u59cb\u6267\u884c \u2192 \u6536\u5230: 1\n\n\/\/ \u7b2c\u4e8c\u6b21\u6536\u96c6\uff0c\u53c8\u4f1a\u91cd\u65b0\u6267\u884c\nnumberFlow.collect { println(&quot;\u6536\u5230: $it&quot;) }  \n\/\/ \u8f93\u51fa\uff1a\u5f00\u59cb\u6267\u884c \u2192 \u6536\u5230: 1  \uff08\u53c8\u4e00\u6b21&quot;\u5f00\u59cb\u6267\u884c&quot;\uff09<\/code><\/pre>\n<p><strong>\u7b80\u5355\u7406\u89e3<\/strong>\uff1aFlow \u5c31\u50cf<strong>\u4e00\u6b21\u6027\u4f7f\u7528\u7684\u53d1\u7535\u673a<\/strong>\uff0c\u6bcf\u6b21\u6709\u4eba\u9700\u8981\u7535\uff0c\u5b83\u5c31\u91cd\u65b0\u53d1\u7535\u3002<\/p>\n<hr \/>\n<h2><span class=\"ez-toc-section\" id=\"2%E9%97%AE%E9%A2%98%EF%BC%9A%E8%83%BD%E4%B8%8D%E8%83%BD%E6%9C%89%E4%B8%AA%E6%B0%B8%E4%B9%85%E7%9A%84%E6%95%B0%E6%8D%AE%E6%B5%81%EF%BC%9F\"><\/span>2.\u95ee\u9898\uff1a\u80fd\u4e0d\u80fd\u6709\u4e2a\u201c\u6c38\u4e45\u7684\u201d\u6570\u636e\u6d41\uff1f<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u4e0a\u9762 Flow \u7684\u95ee\u9898\u662f\uff1a\u6bcf\u6b21\u6536\u96c6\u90fd\u4f1a\u91cd\u65b0\u8fd0\u884c\u3002\u4f46\u6709\u65f6\u5019\u6211\u4eec\u60f3\u8981\u4e00\u4e2a<strong>\u6301\u4e45\u7684\u3001\u5171\u4eab\u7684\u6570\u636e\u6d41<\/strong>\uff0c\u6bd4\u5982\uff1a<\/p>\n<ul>\n<li>\u7528\u6237\u767b\u5f55\u72b6\u6001\uff08\u4e00\u4e2a\u5730\u65b9\u6539\u4e86\uff0c\u6240\u6709\u5730\u65b9\u90fd\u77e5\u9053\uff09<\/li>\n<li>UI \u7684\u72b6\u6001\uff08ViewModel \u6539\u4e86\uff0c\u591a\u4e2a\u9875\u9762\u90fd\u80fd\u6536\u5230\uff09<\/li>\n<\/ul>\n<p>\u8fd9\u65f6\u5019\u5c31\u9700\u8981 <strong>SharedFlow<\/strong>\u3002<\/p>\n<h2><span class=\"ez-toc-section\" id=\"3SharedFlow%EF%BC%9A%E5%85%B1%E4%BA%AB%E7%9A%84%E6%95%B0%E6%8D%AE%E6%B5%81\"><\/span>3.SharedFlow\uff1a\u5171\u4eab\u7684\u6570\u636e\u6d41<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><span class=\"ez-toc-section\" id=\"SharedFlow_%E7%9A%84%E7%89%B9%E7%82%B9%EF%BC%9A%E7%83%AD%E6%B5%81\"><\/span>SharedFlow \u7684\u7279\u70b9\uff1a<strong>\u70ed\u6d41<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<ul>\n<li>\u4e0d\u7ba1\u6709\u6ca1\u6709\u4eba\u6536\u96c6\uff0c\u5b83\u90fd\u53ef\u4ee5\u5b58\u5728<\/li>\n<li>\u591a\u4e2a\u5730\u65b9\u53ef\u4ee5\u540c\u65f6\u6536\u96c6\uff08\u5171\u4eab\uff09<\/li>\n<li>\u65b0\u6765\u7684\u6536\u96c6\u8005\u53ef\u4ee5\u6536\u5230\u4e4b\u524d\u53d1\u9001\u7684\u90e8\u5206\u6570\u636e\uff08\u901a\u8fc7 replay \u8bbe\u7f6e\uff09<\/li>\n<\/ul>\n<p>kotlin<\/p>\n<pre><code>val sharedFlow = MutableSharedFlow&lt;Int&gt;(replay = 2)  \/\/ \u4fdd\u7559\u6700\u8fd1 2 \u6761\u6570\u636e\n\n\/\/ \u5148\u53d1\u9001\u4e00\u4e9b\u6570\u636e\nsharedFlow.emit(1)\nsharedFlow.emit(2)\nsharedFlow.emit(3)\n\n\/\/ \u540e\u5f00\u59cb\u7684\u6536\u96c6\u8005\uff0c\u53ef\u4ee5\u6536\u5230\u6700\u8fd1 2 \u6761\uff082 \u548c 3\uff09\nsharedFlow.collect { value -&gt;\n    println(&quot;\u6536\u5230: $value&quot;)  \/\/ \u8f93\u51fa\uff1a2, 3\n}<\/code><\/pre>\n<h3><span class=\"ez-toc-section\" id=\"%E7%B1%BB%E6%AF%94\"><\/span>\u7c7b\u6bd4<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<ul>\n<li><strong>Flow\uff08\u51b7\u6d41\uff09<\/strong>\uff1a\u70b9\u64ad\u89c6\u9891\uff0c\u6bcf\u4e2a\u4eba\u770b\u90fd\u4ece\u5934\u64ad\u653e<\/li>\n<li><strong>SharedFlow\uff08\u70ed\u6d41\uff09<\/strong>\uff1a\u76f4\u64ad\u9891\u9053\uff0c\u65b0\u8fdb\u6765\u7684\u89c2\u4f17\u53ea\u80fd\u770b\u5230\u6700\u8fd1\u51e0\u5206\u949f\u7684\u5185\u5bb9\uff08replay\uff09<\/li>\n<\/ul>\n<hr \/>\n<h2><span class=\"ez-toc-section\" id=\"4StateFlow%EF%BC%9A%E7%89%B9%E6%AE%8A%E7%9A%84_SharedFlow\"><\/span>4.StateFlow\uff1a\u7279\u6b8a\u7684 SharedFlow<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><code>StateFlow<\/code> \u662f <code>SharedFlow<\/code> \u7684\u4e00\u79cd<strong>\u7279\u5316\u7248\u672c<\/strong>\uff0c\u4e13\u95e8\u7528\u6765\u8868\u793a\u201c\u72b6\u6001\u201d\u3002<\/p>\n<h3><span class=\"ez-toc-section\" id=\"StateFlow_%E7%9A%84%E7%89%B9%E6%AE%8A%E4%B9%8B%E5%A4%84\"><\/span>StateFlow \u7684\u7279\u6b8a\u4e4b\u5904<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: left;\">\u7279\u70b9<\/th>\n<th style=\"text-align: left;\">\u8bf4\u660e<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: left;\">\u5fc5\u987b\u6709\u521d\u59cb\u503c<\/td>\n<td style=\"text-align: left;\">\u4e00\u5f00\u59cb\u5c31\u8981\u6709\u4e2a\u9ed8\u8ba4\u72b6\u6001<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">replay = 1<\/td>\n<td style=\"text-align: left;\">\u6c38\u8fdc\u53ea\u4fdd\u7559\u6700\u65b0\u7684\u4e00\u6761\u6570\u636e<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">\u53ef\u4ee5\u83b7\u53d6\u5f53\u524d\u503c<\/td>\n<td style=\"text-align: left;\">\u901a\u8fc7 <code>.value<\/code> \u76f4\u63a5\u62ff\u5230\u5f53\u524d\u72b6\u6001<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">\u81ea\u52a8\u53bb\u91cd<\/td>\n<td style=\"text-align: left;\">\u5982\u679c\u65b0\u503c\u548c\u65e7\u503c\u76f8\u540c\uff08equals\uff09\uff0c\u4e0d\u4f1a\u901a\u77e5\u6536\u96c6\u8005<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3><span class=\"ez-toc-section\" id=\"%E4%BB%A3%E7%A0%81%E7%A4%BA%E4%BE%8B\"><\/span>\u4ee3\u7801\u793a\u4f8b<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>kotlin<\/p>\n<pre><code>\/\/ \u521b\u5efa\u4e00\u4e2a StateFlow\uff08\u521d\u59cb\u503c\u662f 0\uff09\nval stateFlow = MutableStateFlow(0)\n\n\/\/ \u4fee\u6539\u503c\nstateFlow.value = 1\nstateFlow.value = 2\nstateFlow.value = 2  \/\/ \u76f8\u540c\u7684\u503c\uff0c\u4e0d\u4f1a\u89e6\u53d1\u66f4\u65b0\n\n\/\/ \u83b7\u53d6\u5f53\u524d\u503c\nprintln(stateFlow.value)  \/\/ \u8f93\u51fa 2\n\n\/\/ \u6536\u96c6\u53d8\u5316\nstateFlow.collect { value -&gt;\n    println(&quot;\u72b6\u6001\u53d8\u6210: $value&quot;)  \/\/ \u4f1a\u6253\u5370\uff1a\u72b6\u6001\u53d8\u6210: 0, 1, 2\uff08\u4e0d\u91cd\u590d\u6253\u53702\uff09\n}<\/code><\/pre>\n<h3><span class=\"ez-toc-section\" id=\"%E4%B8%BA%E4%BB%80%E4%B9%88%E8%A6%81%E6%9C%89_StateFlow%EF%BC%9F\"><\/span>\u4e3a\u4ec0\u4e48\u8981\u6709 StateFlow\uff1f<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\u56e0\u4e3a\u5f88\u591a\u573a\u666f\u5c31\u662f\u9700\u8981<strong>\u4e00\u4e2a\u4f1a\u53d8\u5316\u7684\u503c<\/strong>\uff0c\u6bd4\u5982\uff1a<\/p>\n<p>kotlin<\/p>\n<pre><code>\/\/ UI \u72b6\u6001\nval isLoading = MutableStateFlow(false)\nval userName = MutableStateFlow(&quot;&quot;)\nval errorMessage = MutableStateFlow&lt;String?&gt;(null)<\/code><\/pre>\n<hr \/>\n<h2><span class=\"ez-toc-section\" id=\"5Mutable_%E5%89%8D%E7%BC%80%E7%9A%84%E5%90%AB%E4%B9%89\"><\/span>5.Mutable \u524d\u7f00\u7684\u542b\u4e49<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ul>\n<li><strong>StateFlow<\/strong>\uff1a\u53ea\u8bfb\uff0c\u53ea\u80fd\u89c2\u5bdf\uff0c\u4e0d\u80fd\u4fee\u6539<\/li>\n<li><strong>MutableStateFlow<\/strong>\uff1a\u53ef\u8bfb\u5199\uff0c\u53ef\u4ee5\u4fee\u6539\u503c<\/li>\n<\/ul>\n<p>kotlin<\/p>\n<pre><code>\/\/ \u5178\u578b\u7684 ViewModel \u5199\u6cd5\nclass MyViewModel : ViewModel() {\n    \/\/ \u79c1\u6709\u7684\uff0c\u53ef\u4fee\u6539\u7684\u7248\u672c\n    private val _count = MutableStateFlow(0)\n\n    \/\/ \u516c\u5f00\u7684\uff0c\u53ea\u8bfb\u7248\u672c\n    val count: StateFlow&lt;Int&gt; = _count\n\n    fun increment() {\n        _count.value++  \/\/ \u5185\u90e8\u4fee\u6539\n    }\n}\n\n\/\/ \u5916\u90e8\u4f7f\u7528\nviewModel.count.collect { value -&gt;\n    \/\/ \u53ea\u80fd\u770b\u5230\u503c\uff0c\u4e0d\u80fd\u4fee\u6539\n}<\/code><\/pre>\n<hr \/>\n<h2><span class=\"ez-toc-section\" id=\"6%E5%85%B3%E7%B3%BB%E6%80%BB%E7%BB%93%E5%9B%BE\"><\/span>6.\u5173\u7cfb\u603b\u7ed3\u56fe<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>text<\/p>\n<pre><code>Flow\uff08\u51b7\u6d41\uff09\n  \u2514\u2500\u2500 \u6bcf\u6b21\u6536\u96c6\u90fd\u91cd\u65b0\u6267\u884c\n  \u2514\u2500\u2500 \u72ec\u7acb\u7684\u6570\u636e\u6d41\n        \u2193\nSharedFlow\uff08\u70ed\u6d41\uff09\n  \u2514\u2500\u2500 \u5171\u4eab\u7684\u6570\u636e\u6d41\n  \u2514\u2500\u2500 \u53ef\u4ee5\u8bbe\u7f6e replay\uff08\u65b0\u6536\u96c6\u8005\u6536\u5230\u591a\u5c11\u5386\u53f2\u6570\u636e\uff09\n        \u2193\nStateFlow\uff08\u7279\u6b8a\u7684 SharedFlow\uff09\n  \u2514\u2500\u2500 replay = 1\uff08\u53ea\u4fdd\u7559\u6700\u65b0\uff09\n  \u2514\u2500\u2500 \u5fc5\u987b\u6709\u521d\u59cb\u503c\n  \u2514\u2500\u2500 \u53ef\u4ee5 .value \u83b7\u53d6\u5f53\u524d\u503c\n  \u2514\u2500\u2500 \u81ea\u52a8\u53bb\u91cd\n        \u2193\nMutableStateFlow\uff08\u53ef\u4fee\u6539\u7684 StateFlow\uff09\n  \u2514\u2500\u2500 \u53ef\u4ee5\u4fee\u6539 value\n  \u2514\u2500\u2500 \u901a\u5e38\u79c1\u6709\u5316\uff0c\u5bf9\u5916\u66b4\u9732 StateFlow<\/code><\/pre>\n<hr \/>\n<h2><span class=\"ez-toc-section\" id=\"7%E4%BB%80%E4%B9%88%E6%97%B6%E5%80%99%E7%94%A8%E5%93%AA%E4%B8%AA%EF%BC%9F\"><\/span>7.\u4ec0\u4e48\u65f6\u5019\u7528\u54ea\u4e2a\uff1f<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: left;\">\u9700\u6c42<\/th>\n<th style=\"text-align: left;\">\u7528\u4ec0\u4e48<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: left;\">\u7f51\u7edc\u8bf7\u6c42\u3001\u6570\u636e\u5e93\u67e5\u8be2\uff08\u4e00\u6b21\u6027\u64cd\u4f5c\uff09<\/td>\n<td style=\"text-align: left;\">\u666e\u901a <code>Flow<\/code><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">\u4e8b\u4ef6\uff08\u70b9\u51fb\u3001\u5f39\u7a97\u3001\u5bfc\u822a\uff09<\/td>\n<td style=\"text-align: left;\"><code>SharedFlow<\/code><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">\u72b6\u6001\uff08\u52a0\u8f7d\u4e2d\u3001\u7528\u6237\u4fe1\u606f\u3001\u5f00\u5173\u72b6\u6001\uff09<\/td>\n<td style=\"text-align: left;\"><code>StateFlow<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h2><span class=\"ez-toc-section\" id=\"8%E4%B8%80%E4%B8%AA%E5%AE%8C%E6%95%B4%E7%9A%84%E4%BE%8B%E5%AD%90\"><\/span>8.\u4e00\u4e2a\u5b8c\u6574\u7684\u4f8b\u5b50<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>kotlin<\/p>\n<pre><code>class UserViewModel : ViewModel() {\n    \/\/ \u72b6\u6001\u7528 StateFlow\n    private val _userName = MutableStateFlow(&quot;\u672a\u767b\u5f55&quot;)\n    val userName: StateFlow&lt;String&gt; = _userName\n\n    \/\/ \u4e8b\u4ef6\u7528 SharedFlow\n    private val _toastEvent = MutableSharedFlow&lt;String&gt;()\n    val toastEvent: SharedFlow&lt;String&gt; = _toastEvent\n\n    fun login(name: String) {\n        _userName.value = name  \/\/ \u66f4\u65b0\u72b6\u6001\n        viewModelScope.launch {\n            _toastEvent.emit(&quot;\u6b22\u8fce $name&quot;)  \/\/ \u53d1\u9001\u4e00\u6b21\u6027\u4e8b\u4ef6\n        }\n    }\n}<\/code><\/pre>\n<h1><span class=\"ez-toc-section\" id=\"%E4%B8%89%E3%80%81repeatOnLifecycle_%E6%88%96_shareIn\"><\/span>\u4e09\u3001repeatOnLifecycle \u6216 shareIn<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<h3><span class=\"ez-toc-section\" id=\"%F0%9F%86%9A_%E6%A0%B8%E5%BF%83%E5%8C%BA%E5%88%AB%E4%B8%8E%E8%81%94%E7%B3%BB\"><\/span>\ud83c\udd9a \u6838\u5fc3\u533a\u522b\u4e0e\u8054\u7cfb<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\u901a\u8fc7\u4e0b\u8868\u53ef\u4ee5\u66f4\u6e05\u6670\u5730\u7406\u89e3\u4e24\u8005\u7684\u5b9a\u4f4d\uff1a<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: left;\">\u5bf9\u6bd4\u7ef4\u5ea6<\/th>\n<th style=\"text-align: left;\"><code>repeatOnLifecycle<\/code><\/th>\n<th style=\"text-align: left;\"><code>shareIn<\/code><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: left;\"><strong>\u4e3b\u8981\u89d2\u8272<\/strong><\/td>\n<td style=\"text-align: left;\"><strong>\u751f\u547d\u5468\u671f\u5b89\u5168\u7684\u6536\u96c6\u5668<\/strong><\/td>\n<td style=\"text-align: left;\"><strong>\u6570\u636e\u6e90\u5171\u4eab\u8f6c\u6362\u5668<\/strong><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\"><strong>\u4f7f\u7528\u4f4d\u7f6e<\/strong><\/td>\n<td style=\"text-align: left;\"><code>Activity<\/code> \/ <code>Fragment<\/code> (\u754c\u9762\u5c42)<\/td>\n<td style=\"text-align: left;\"><code>ViewModel<\/code> \/ \u6570\u636e\u5c42<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\"><strong>\u6838\u5fc3\u76ee\u7684<\/strong><\/td>\n<td style=\"text-align: left;\">\u6839\u636e\u751f\u547d\u5468\u671f<strong>\u81ea\u52a8\u5f00\u59cb\/\u505c\u6b62\u6536\u96c6<\/strong>\uff0c\u8282\u7701\u8d44\u6e90\uff0c\u907f\u514d\u5d29\u6e83\u3002<\/td>\n<td style=\"text-align: left;\">\u5c06\u51b7\u6d41\u53d8\u4e3a\u70ed\u6d41\uff0c<strong>\u5171\u4eab\u6570\u636e\u6e90<\/strong>\uff0c\u907f\u514d\u91cd\u590d\u8ba1\u7b97\u3002<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\"><strong>\u64cd\u4f5c\u5bf9\u8c61<\/strong><\/td>\n<td style=\"text-align: left;\">\u4efb\u4f55 <code>Flow<\/code><\/td>\n<td style=\"text-align: left;\">\u901a\u5e38\u662f<strong>\u51b7\u6d41<\/strong><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\"><strong>\u4ea7\u51fa\u7ed3\u679c<\/strong><\/td>\n<td style=\"text-align: left;\">\u65e0\uff0c\u5b83\u662f\u6536\u96c6\u884c\u4e3a\u672c\u8eab<\/td>\n<td style=\"text-align: left;\">\u4e00\u4e2a\u53ef\u4ee5\u88ab\u591a\u4e2a\u6536\u96c6\u8005\u5171\u4eab\u7684<strong>\u70ed\u6d41<\/strong> (<code>SharedFlow<\/code>)<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\"><strong>\u5173\u952e\u53c2\u6570<\/strong><\/td>\n<td style=\"text-align: left;\"><code>Lifecycle.State<\/code> (\u5982 <code>STARTED<\/code>)<\/td>\n<td style=\"text-align: left;\"><code>started<\/code> (\u542f\u52a8\u7b56\u7565, \u5982 <code>WhileSubscribed<\/code>) \u548c <code>replay<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3><span class=\"ez-toc-section\" id=\"%F0%9F%92%A1_%E5%8D%8F%E5%90%8C%E5%B7%A5%E4%BD%9C%E6%A8%A1%E5%BC%8F\"><\/span>\ud83d\udca1 \u534f\u540c\u5de5\u4f5c\u6a21\u5f0f<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\u5b83\u4eec\u4fe9\u7ecf\u5e38\u5728\u67b6\u6784\u4e2d<strong>\u534f\u540c\u5de5\u4f5c<\/strong>\uff1a<\/p>\n<ol>\n<li><strong>\u5728 <code>ViewModel<\/code> \u4e2d<\/strong>\uff0c\u60a8\u4f7f\u7528 <code>shareIn<\/code> \u6216 <code>stateIn<\/code> \u5c06\u4e00\u4e2a\u5e95\u5c42\u7684\u51b7\u6d41\u8f6c\u6362\u4e3a\u70ed\u6d41\uff08\u5982 <code>StateFlow<\/code>\uff09\uff0c\u5e76\u66b4\u9732\u7ed9\u754c\u9762\u5c42\u3002<\/li>\n<li><strong>\u5728 <code>Fragment<\/code> \u4e2d<\/strong>\uff0c\u60a8\u4f7f\u7528 <code>repeatOnLifecycle<\/code> \u6765\u5b89\u5168\u5730\u6536\u96c6\u8fd9\u4e2a\u66b4\u9732\u51fa\u6765\u7684\u70ed\u6d41\uff0c\u786e\u4fdd\u754c\u9762\u5728\u53ef\u89c1\u65f6\u624d\u66f4\u65b0\uff0c\u4e0d\u53ef\u89c1\u65f6\u81ea\u52a8\u505c\u6b62\u6536\u96c6\u3002<\/li>\n<\/ol>\n<p>\u8fd9\u79cd\u6a21\u5f0f\u65e2\u4fdd\u8bc1\u4e86\u6570\u636e\u6e90\u7684\u5171\u4eab\u548c\u6548\u7387\uff0c\u53c8\u4fdd\u8bc1\u4e86\u754c\u9762\u5c42\u6536\u96c6\u7684\u5b89\u5168\u6027\uff0c\u662f\u5b98\u65b9\u63a8\u8350\u7684\u67b6\u6784\u5b9e\u8df5\u3002<\/p>\n<button class=\"simplefavorite-button\" data-postid=\"16276\" data-siteid=\"1\" data-groupid=\"1\" data-favoritecount=\"0\" style=\"\">\u6536\u85cf <i class=\"sf-icon-star-empty\"><\/i><\/button>","protected":false},"excerpt":{"rendered":"<p>\u76ee\u5f55 \u4e00\u3001\u6570\u636e\u6d41\u57fa\u672c\u4ecb\u7ecd\ud83c\udfaf \u6838\u5fc3\u6982\u5ff5\uff1a\u5f02\u6b65\u6570\u636e\u5e8f\u5217\ud83c\udfd7\ufe0f Flow \u7684\u57fa\u77f3\uff1a\u51b7\u6d41\u4e0e\u70ed\u6d41\u4e3b\u8981 API \u4e0e [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1259],"tags":[],"_links":{"self":[{"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/posts\/16276"}],"collection":[{"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=16276"}],"version-history":[{"count":4,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/posts\/16276\/revisions"}],"predecessor-version":[{"id":16387,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/posts\/16276\/revisions\/16387"}],"wp:attachment":[{"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=16276"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=16276"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=16276"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}