Skip to content
pubscout

async_field

1.1.5, released 2 weeks ago by an unverified publisher

Async fields with observable values, caching and stale handling for any data source

WASM-ready
$ flutter pub add async_field
Source repository

What it does

Provides a storage-backed field abstraction that can fetch, save and observe values asynchronously. Fields expose default values, fetchers, savers and change listeners, and support stale data handling and periodic refresh.

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

Use it when

  • You need to fetch data from a remote API and keep it in sync with local storage
  • You want observable async values that notify listeners on change
  • You need a simple cache with stale‑value support without a full state‑management solution

Skip it when

  • You already use a full state‑management library like Riverpod or Bloc
  • You need complex dependency injection or navigation features

Strengths

  • Zero‑config async field abstraction
  • Supports multiple storage backends (DB, HTTP, isolates)
  • Built‑in change listeners and stale‑value handling
  • Null safety and modern Dart SDK compatibility

Weaknesses

  • Limited to async field use‑cases, not a general state manager
  • No built‑in UI widgets or integration with Flutter widgets
  • Requires manual wiring of fetchers/savers

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
2

Add dependency, import package, create AsyncStorage and define fields

import 'package:async_field/async_field.dart';
var storage = AsyncStorage();
var field = storage.getField<double>('btc_usd')
  ..defaultValue = double.nan
  ..withFetcher(_fetchBtcUsd)
  ..onChange.listen((f)=>print('changed: $f'));
await field.get();

Alternatives

Packages that do the same job and could replace async_field.

Works with

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