Skip to content
pubscout

enhanced_future_builder

2.0.0, released 4 years ago by an unverified publisher

A wrapper for FutureBuilder to improve readability and prevent unwanted refiring.

WASM-readyRepository archived
$ flutter pub add enhanced_future_builder
Source repository

What it does

It wraps Flutter's standard FutureBuilder widget to simplify handling various connection states and provides an option to remember the future result across rebuilds. This prevents the future from refiring when parent widgets call setState.

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

Use it when

  • You want to prevent your FutureBuilder from re-fetching data every time setState is called.
  • You want a cleaner, builder-less syntax for handling different future connection states.

Skip it when

  • You need complex custom builder logic that doesn't fit into the predefined connection state callbacks.

Strengths

  • Solves the common FutureBuilder refiring issue with a simple flag.
  • Improves readability by removing the need for verbose connectionState checks in a builder function.

Weaknesses

  • Provides a limited set of opinionated state callbacks compared to raw FutureBuilder.

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
0
EnhancedFutureBuilder(
  future: widget._api.getRandomCat(),
  rememberFutureResult: true,
  whenDone: (dynamic cat) => _showCatWidget(cat),
  whenNotDone: Center(child: Text('Loading...')),
)

Alternatives

Packages that do the same job and could replace enhanced_future_builder.