FlutterのIncorrect use of ParentDataWidget.をなんとかしたい!
概要
今回の記事では、FlutterのIncorrect use of ParentDataWidget.をなんとかする手順を掲載する。
仕様書
環境
- Android Studio Giraffe | 2023.2.1 Patch 2
- Flutter 3.19.6
手順書
これは例えばExpandedやFlexibleなどが対応してる親の中で使われてないのが原因。
エラーが発生する例
対応してる親が設定されておらずIncorrect use of ParentDataWidget.が発生する例。
Expanded(
  child: const Text("Expanded Text"),
),エラーが発生しない例
対応してる親(例えばColumn)の中でExpandedを使う例。
Column(
  children:
  [
    Expanded(
      child: const Text("Expanded Text")
    ),
  ]
),こんな感じで使えばエラーは発生しない。
まとめ(感想文)
分かれば簡単なことなんだけどもね。

