Skip to content
pubscout

nested

1.0.0, released 6 years ago by dash-overflow.net

Widget that flattens deeply nested widget trees into a list of children.

WASM-ready
$ flutter pub add nested
Source repository

What it does

Nested provides a `Nested` widget that accepts a list of `SingleChildWidget`s, allowing developers to write long widget trees in a flat, readable form. It also introduces `SingleChildStatelessWidget` and `SingleChildStatefulWidget` to enable widgets to be used both normally and within `Nested`.

AI-written summary of version 1.0.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You have deeply nested widget trees that hurt readability.
  • You want to reuse custom widgets that can be placed inside a flat list without refactoring the entire tree.
  • You need a concise syntax for building complex UI hierarchies.

Skip it when

  • You prefer the traditional nested syntax for simplicity.
  • Your widgets do not support the SingleChildWidget interface and you cannot modify them.

Strengths

  • Improves readability of complex widget trees
  • Supports null safety and modern Flutter patterns
  • Allows custom widgets to be used both normally and inside Nested

Weaknesses

  • Requires widgets to implement SingleChildWidget or use mixins
  • Limited to single-child widgets
  • Adds an extra layer of abstraction that may be unnecessary for simple UIs

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
0
```dart
Nested(
  children: [
    MyWidget(),
    AnotherWidget(),
    Again(),
    AndAgain(),
  ],
  child: Leaf(),
),
```

Alternatives

Packages that do the same job and could replace nested.

Works with

Packages commonly used together with nested: ones it builds on, ones built on it, and its own family.