【Flutter】「The ‘child’ argument should be last in widget constructor invocations.」の意味と対策

Flutterの「The ‘child’ argument should be last in widget constructor invocations.」の意味と対策について紹介します。

スポンサーリンク

Unnecessary ‘new’ keyword. (Documentation) Try removing the ‘new’ keyword.

margin: new EdgeInsets.fromLTRB(1, 0, 1, 0));

Flutterの上記部分に対して、以下のような修正案のメッセージが提示されていました。

The 'child' argument should be last in widget constructor invocations. (Documentation)  Try moving the argument to the end of the argument list.

「childの引数は、ウィジェット コンストラクターの呼び出しの最後に置く必要があります。 (ドキュメント) 引数を引数リストの最後に移動してみてください。」ということなので、以下のように移動させるとメッセージが消えました。

margin: const EdgeInsets.fromLTRB(1, 0, 1, 0));
【Flutter入門】iOS、Android、Windowsアプリ開発
FlutterによるiOS、Android、Windowsアプリ開発について入門者向けに紹介します。
flutter
スポンサーリンク

コメント