sort_child_properties_last
Details about the 'sort_child_properties_last' diagnostic produced by the Dart analyzer.
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:
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:
import 'package:flutter/material.dart';
Widget createWidget() {
return Center(
widthFactor: 0.5,
child: Text('...'),
);
}
除非另有说明,文档之所提及适用于 Dart 3.10.3 版本报告页面问题.