美文网首页
问:Flutter - null safety

问:Flutter - null safety

作者: 囧rg | 来源:发表于2023-05-02 19:53 被阅读0次

    遇到问题 Cannot run with sound null safety

    flutter sdk 版本升级到2.0或者更高的版本后,运行之前的代码会报错,比如:

    Error: Cannot run with sound null safety, because the following dependencies
    don't support null safety:
    
     - package:flutter_swiper
     - package:flutter_page_indicator
     - package:transformer_page_view
    
    For solutions, see https://dart.dev/go/unsound-null-safety
    
    
    FAILURE: Build failed with an exception.
    

    上面的问题是,这些包不支持 safety模式。我们可以在运行的时候添加--no-sound-null-safety

    解决方案:

     run
     flutter run --no-sound-null-safety
    
     build
     flutter build apk --no-sound-null-safety
    
    
    

    相关文章

      网友评论

          本文标题:问:Flutter - null safety

          本文链接:https://www.haomeiwen.com/subject/jaqzjdtx.html