Skip to main content

Widgets Nesting Level

The depths of widgets used inside a build method.

Deeply nested widget trees are read and maintain. It's recommended to keep the widgets nesting level as small as possible.

A recommended WNL is 10 or less.

Config example

widgets-nesting-level: 10


class MyCustomWidget extends StatelessWidget {
const MyCustomWidget();

Widget build(BuildContext context) {
final widget = const Expanded(
child: Center(
child: Text('Hello, world!'),

return Material(
child: Column(
children: [
MyAppBar(title: Text('Example title')),

Widgets Nesting Level for this example is 5.