什么是 flutter 存储库

What are flutter repositories

我来自react。我正在阅读有关存储库的信息,但不太了解。

是不是有点像redux store? React 中是否有任何等价物可以帮助理解它。

谢谢

有很多库可以帮助您分离业务逻辑和 UI,还可以帮助您实现响应式编程。如果你了解 React 中的 Redux,你可以看看这些包,尤其是 redux for flutter and implement it inside your app. Other options might be mobX or library created by google especially for flutter with name BloC. And in the end, if you looking for something different, that combine most of the good stuff from all of those solutions and add some more to the bucket, i recommend you to take a look at package called flutter_control.

存储库与 Flutter 无关。它是一个 design pattern,具有多种语言的多种实现。

[A repository m]ediates between the domain and data mapping layers using a collection-like interface for accessing domain objects.

它可以用于状态,但更一般地用于数据。这可以是用户数据或参考数据或您想要保留的任何其他类型。