Flutter 編譯報錯 Error: The method DioHttpHeaders.add has fewer named arguments than those Context

1.報錯問題:最近更新Android Studio 4.0 連同Flutter 一起更新,導致原有項目運行報錯:

Error: The method 'DioHttpHeaders.add' has fewer named arguments than those
Context: This is the overridden method ('add'). void add(String name, Object value,...

 

解決方法:打開pubspec.yaml 文件修改 dio 版本號,更行爲最新版本(鼠標指向版本號時,會提示最新的版本號)完美解決;

​

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.3  更新一下最新版本
  #添加網絡請求庫
  dio: ^3.0.9 更新一下最新版本
​

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章