Flutter状态State的5种应对方法

{"type":"doc","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"本文最初发布于poetryincode.dev网站,经原作者授权由InfoQ中文站翻译并分享。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"点击这里查看本文中示例的代码。("},{"type":"link","attrs":{"href":"https:\/\/github.com\/chimon2000\/flutter_state_five_ways","title":"","type":null},"content":[{"type":"text","text":"https:\/\/github.com\/chimon2000\/flutter_state_five_ways"}]},{"type":"text","text":")"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"不管你是刚开始了解Flutter,还是已经接触Flutter有了一段时间,你都可能已经知道有很多方法可以处理应用程序状态。我可以肯定,每个月都会冒出来一些新的途径。因为没有太多可以直接对比的例子,所以想要了解这些方法之间的差异和各自的权衡可能会很困难。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"我认为,学习如何使用一个库的最佳方法是用它来构建项目。对比两个库的最佳方法是用它们来执行相同的任务:构建相同的功能,从而更好地了解彼此的权衡所在。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"在本文中,我将使用同样的应用程序作为基础,用我很喜欢的几位作者制作的5个库,使用相同的模式来实现共享状态。这些库有的很流行,有的罕见,有的很新,有的相对老旧。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"numberedlist","attrs":{"start":1,"normalizeStart":1},"content":[{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":1,"align":null,"origin":null},"content":[{"type":"text","text":"Riverpod(带有StateNotifier)"}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":2,"align":null,"origin":null},"content":[{"type":"text","text":"Bloc"}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":3,"align":null,"origin":null},"content":[{"type":"text","text":"flutter_command"}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":4,"align":null,"origin":null},"content":[{"type":"text","text":"MobX"}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":5,"align":null,"origin":null},"content":[{"type":"text","text":"binder"}]}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"我会尽力找出各个库之间的差异,并对每种方法做一个总结。为了演示各个库的API,我们将实现一个笔记应用,它会显示一个输入字段以创建新的笔记,还会显示已创建笔记的列表。你可以在这里观看演示效果("},{"type":"link","attrs":{"href":"https:\/\/flutter-state.codemagic.app\/","title":"","type":null},"content":[{"type":"text","text":"https:\/\/flutter-state.codemagic.app\/"}]},{"type":"text","text":")。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}}]}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章