0
点赞
收藏
分享

微信扫一扫

flutter中provider使用

静鸡鸡的JC 2021-10-09 阅读 62
Flutter

flutter官方provider

使用技巧

  • ConsumerSelector

  • 读取provider中的数据
    通过context.watchcontext.readcontext.select实现:
    context.watch<T>(),使widget能够监听泛型T上发生的改变。
    context.read<T>(),直接返回T,不会监听改变。
    context.select<T, R>(R cb(T value)),允许widget只监听T上的一部分R

举报

相关推荐

0 条评论