flutter_async_value 1.2.3 copy "flutter_async_value: ^1.2.3" to clipboard
flutter_async_value: ^1.2.3 copied to clipboard

A simple and elegant way to handle async states (initial, loading, data, error) in Flutter apps.

example/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_async_value/flutter_async_value.dart';

class MyWidget extends StatelessWidget {
  final AsyncValue<String, Exception> value;

  const MyWidget({super.key, required this.value});

  @override
  Widget build(BuildContext context) {
    return AsyncValueBuilder(
      value: value,
      initial: (_) => ElevatedButton(
        onPressed: () => print('Fetch data'),
        child: const Text('Start'),
      ),
      loading: (_) => const CircularProgressIndicator(),
      data: (_, data) => Text('Fetched: $data'),
      error: (_, error) => Text('Error: $error'),
    );
  }
}
3
likes
160
points
241
downloads

Publisher

unverified uploader

Weekly Downloads

A simple and elegant way to handle async states (initial, loading, data, error) in Flutter apps.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on flutter_async_value