Flutter 「The method ‘RaisedButton’ isn’t defined for the type」の対処法
「Flutter」で「RaisedButton」を使用時に、「The method ‘RaisedButton’ isn’t defined for the type」が発生した場合の対処法を記述してます。
環境
- OS windows11 pro 64bit
- Flutter 3.3.1
エラー全文
以下のコードで発生。
body: Center(
child: RaisedButton(
onPressed: () {},
child: Text(
"button",
),
エラー全文
The method 'RaisedButton' isn't defined for the type '_MyHomePageState'.
Try correcting the name to the name of an existing method, or defining a method named 'RaisedButton'.dartundefined_method
原因
「RaisedButton」は廃止になったため
対処法
「ElevatedButton」を使用する
child: ElevatedButton(
onPressed: () {},
child: Text(
"button",
),
-
前の記事
javascript 文字列から数値のみを抽出する 2022.09.26
-
次の記事
GAS スプレッドシートのシートにあるグラフの数を取得する 2022.09.26
コメントを書く