🤮

Xcode関係 Flutterのエラーの対処法 Error: 'lithrow' isn't a type.

2022/11/22に公開

気づき

lithrowとなっていた原因はわからないが エラー自体に li はいらないと書かれていた気がする
lithrow FlutterError.fromParts(<DiagnosticsNode>[
^^^^^^^
エラーの箇所示してくれてることに気づいた

エラー文

Writing result bundle at path:
/var/folders/hc/f4r2pjd51_d5jcsgc6dss5tr0000gn/T/flutter_tools.yVNQS6/flutter_ios_build_temp_dirU93AIK/temporary_xcresult_bundle

../../../../development/flutter/packages/flutter/lib/src/rendering/object.dart:3658:9: Error: 'lithrow' isn't a type.
        lithrow FlutterError.fromParts(<DiagnosticsNode>[
        ^^^^^^^
../../../../development/flutter/packages/flutter/lib/src/rendering/object.dart:3658:17: Error: Expected ';' after this.
        lithrow FlutterError.fromParts(<DiagnosticsNode>[
                ^^^^^^^^^^^^
../../../../development/flutter/packages/flutter/lib/src/rendering/object.dart:3658:29: Error: Expected an identifier, but got '.'.
Try inserting an identifier before '.'.
        lithrow FlutterError.fromParts(<DiagnosticsNode>[

Failed to package
Command PhaseScriptExecution failed with a nonzero exit code
note: Building targets in dependency order
warning: Run script build phase 'Run Script' will be run during every build because it does not specify any outputs.
To address this warning, either add output dependencies to the script phase,
or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Runner' from project 'Runner')
warning: Run script build phase 'Thin Binary' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Runner' from project 'Runner')
Result bundle written to path:
/var/folders/hc/f4r2pjd51_d5jcsgc6dss5tr0000gn/T/flutter_tools.yv8ZUS/flutter_ios_build_temp_dirKJN4fv/temporary_xcresult_bundle

はじめに試すこと

flutter clean
ほとんどの場合はこれで解決する

flutter pub get
flutter pub upgrade

https://qiita.com/kuluna/items/2225298e8a9a7b3b3ef6

https://stackoverflow.com/questions/36902497/cannot-install-cocoapods-no-podfile-found-in-the-project-directory

Xcodeを修正する

参考記事
やること
XcodeのBased on dependency analythicsのチェックを外す
https://blog.covelline.com/entry/2022/10/07/130659
場所がわからない人用
Runner -> Build Phase



に行ってScript を探す

最終手段 Flutterを修正する

必ず読むこと
Flutterのコードを修正することは 他のエラーの可能性になるため 他に取れる手段がない時に限り実行すること。 Flutter clean Xcodeの入れ直し等で治る可能性も十分あるため
またエラーが出ている箇所を特定し エラーが出ているかを把握してから行うこと。

今回の場合
flutter/lib/src/rendering/object.dart:3658:9: Error: 'lithrow' isn't a type.

object.dartの3658行目がおかしいことを突き止め
lithrowを throw に修正した。

修正したことを示すコメント等があれば直よし

参考記事
https://stackoverflow.com/questions/73384906/error-kethrow-isnt-a-type-kethrow-clientsocketexceptionerror-request-url

Discussion