avoid_unnecessary_containers

Group: style

Maturity: stable

Linter v0.1.102

Since info is static, may be stale
flutter

View all Lint Rules

Using the Linter

Avoid wrapping widgets in unnecessary containers.

Wrapping a widget in Container with no other parameters set has no effect and makes code needlessly more complex.

BAD:

Widget buildRow() {
  return Container(
      child: Row(
        children: <Widget>[
          const MyLogo(),
          const Expanded(
            child: Text('...'),
          ),
        ],
      )
  );
}

GOOD:

Widget buildRow() {
  return Row(
    children: <Widget>[
      const MyLogo(),
      const Expanded(
        child: Text('...'),
      ),
    ],
  );
}