sort_child_properties_last
The '{0}' argument should be last in widget constructor invocations.
Description
#The analyzer produces this diagnostic when the child
or children
argument isn't the last argument in an invocation of a widget class'
constructor. An exception is made if all of the arguments after the
child
or children
argument are function expressions.
Example
#The following code produces this diagnostic because the child
argument
isn't the last argument in the invocation of the Center
constructor:
dart
import 'package:flutter/material.dart';
Widget createWidget() {
return Center(
child: Text('...'),
widthFactor: 0.5,
);
}
Common fixes
#Move the child
or children
argument to be last:
dart
import 'package:flutter/material.dart';
Widget createWidget() {
return Center(
widthFactor: 0.5,
child: Text('...'),
);
}
除非另有说明,文档之所提及适用于 Dart 3.7.3 版本,本页面最后更新时间: 2025-05-08。 查看文档源码 或者 报告页面问题。