【问题标题】:Make custom flutter widget deprecated弃用自定义颤振小部件
【发布时间】:2021-08-19 18:25:54
【问题描述】:

我怎样才能使我自己的颤振小部件/颤振类被弃用(这样当我或其他人将该类用作小部件时,会有一个弃用的注释)?

这是我当前的代码:https://gist.github.com/janhecker/538a8f0610a29e6be6c7fbce1f525d39

【问题讨论】:

    标签: flutter widget deprecated


    【解决方案1】:

    只需将其添加到您的小部件顶部:

    @Deprecated('Use this other widget instead')
    class MyWidget extends StatelessWidget { ... }
    

    【讨论】:

      猜你喜欢
      • 2018-09-13
      • 1970-01-01
      • 1970-01-01
      • 2020-09-07
      • 2020-07-27
      • 1970-01-01
      • 2021-06-03
      • 2021-11-25
      • 2019-12-20
      相关资源
      最近更新 更多