1.多tab頁面出現的問題
最近在寫demo的時候報了一個錯:
There are multiple heroes that share the same tag within a subtree。
在這裏找到了解決方法:
主要原因是我的page頁面都包含了FloatingActionButton這個Widget,在FloatingActionButton下添加heroTag即可解決:
floatingActionButton: FloatingActionButton(
heroTag:"Child1" ,
onPressed: add,
child: Icon(Icons.add),
)
2.sdk損壞
git clean -xfd
git stash save --keep-index
git stash drop
git pull
flutter doctor
3.版本不一致可能出現問題
某些類庫使用flutter編譯版本不同,可能出現錯誤:
widget_util.dart:115:8: Error: No named parameter with the name 'onError'.
}, onError: (dynamic exception, StackTrace stackTrace) {
^^^^^^^
Compiler failed on /Users/unreal/Downloads/flutter/lib/main.dart
Gradle task assembleDebug failed with exit code 1
具體參看作者的flutter類庫版本