sort-child-properties-last
Same as sort_child_properties_last in Dart lints
- Group
- Style
- Path
lint/style/sort-child-properties-last- Default
- On (recommended)
- Origin
- Dart lints
- Domain
- flutter
- Rule
- 436 of 512
Sort Widget-valued child properties last, except before closure arguments.
Invalid
// Bad: the child/children argument is not last in a widget constructor call.
import 'package:flutter/material.dart';
Widget b0() => Center(child: Text('a'), key: Key('k'));
Widget b1() => Column(children: [Text('a'), Text('b')], key: Key('k'));
Widget b2() => Padding(child: Text('a'), padding: EdgeInsets.zero);
Widget b3() => Container(child: Text('a'), width: 10);
Widget b4() => SizedBox(child: Text('a'), width: 10, height: 10); Widget b0() => Center(child: Text('a'), key: Key('k')); Widget b1() => Column(children: [Text('a'), Text('b')], key: Key('k')); Widget b2() => Padding(child: Text('a'), padding: EdgeInsets.zero); Widget b3() => Container(child: Text('a'), width: 10); Widget b4() => SizedBox(child: Text('a'), width: 10, height: 10);Valid
// Good: child/children is last, absent, or the call is not a widget constructor.
import 'package:flutter/material.dart';
Widget g0() => Center(key: Key('k'), child: Text('a'));
Widget g1() => Column(key: Key('k'), children: [Text('a'), Text('b')]);
Widget g2() => Padding(padding: EdgeInsets.zero, child: Text('a'));
Widget g3() => Text('no child');
Widget g4() => SizedBox(width: 10, height: 10, child: Text('a'));
Widget g5() => Center(child: Text('a'));
int g6() => doWork(child: 5, other: 6);Configure sort-child-properties-last
Set its severity in falcon.json. See the configuration guide.
{
"linter": {
"rules": {
"style": {
"sort-child-properties-last": "error"
}
}
}
}Or silence one occurrence with a suppression comment; the reason is required.
// falcon-ignore lint/style/sort-child-properties-last: <reason>More style rules
- sort-constructors-first
sort_constructors_firstFlags a constructor declared after a non-constructor member.
- sort-unnamed-constructors-first
sort_unnamed_constructors_firstFlags an unnamed constructor declared after a named constructor.
- tighten-type-of-initializing-formals
tighten_type_of_initializing_formalsFlags a nullable
this.xorsuper.xinitializing formal whose constructor assertsx != null. - type-annotate-public-apis
type_annotate_public_apisrecommendedRequires type annotations on public declarations.
- type-init-formals
type_init_formalsrecommendedFlags a *redundant* type annotation on an initializing formal or super parameter (
type-init-formals, adopted from package:lints). - unawaited-futures
unawaited_futuresrecommendedFutureresults inasyncbodies must be awaited or markedunawaited. - unintended-html-in-doc-comment
unintended_html_in_doc_commentrecommendedFlags angle-bracket text in doc comments that Markdown would render as an HTML tag.
- unnecessary-await-in-return
unnecessary_await_in_returnAvoid
awaiton a returnedFuturethe function's ownFuturealready covers.