1."desktop" already exists at the specified project location
創(chuàng)建項目的根目錄上加上項目名,防止混亂
2.創(chuàng)建flutter項目名只能是小寫字母、數(shù)字、下劃線(不能大寫)
3.導入material出錯是還沒有獲取到package,終端執(zhí)行flutter packages get ,接下來終端報錯:Error: No pubspec.yaml file found. 需要終端切換到項目目錄下。
4.Waiting for another flutter command to release the startup lock.. 終端命令報錯
在FlutterSDk目錄上,bin/cache/lockfile,刪除lockfile
5.自定義了一個Sharedpreferences操作的工具類,在讀取時報錯,type'Future<dynamic>' is not a subtype of type 'String' in type cast
Future<dynamic> getData(String key) async {
SharedPreferences prefs = await SharedPreferences.getInstance();
return prefs.get(key);
}
分析:由于方法是異步的,不能直接使用。
解決:getData('key').then(value){};
6.報錯Incorrect use of ParentDataWidget.
在Widge中使用了不正確的組件,如在row、column中使用了Positioned