easy_future_builder 1.0.0 copy "easy_future_builder: ^1.0.0" to clipboard
easy_future_builder: ^1.0.0 copied to clipboard

Provides a better `FutureBuilder` experience.

easy_future_builder #

Provides a better FutureBuilder experience.

Installation #

flutter pub add easy_future_builder

Usage #

EasyFutureBuilder widget #

import 'package:easy_future_builder/easy_future_builder.dart';

class HomePage extends StatelessWidget {
  const HomePage({super.key});
  
  @override
  Widget build(BuildContext context) {
    return EasyFutureBuilder<String>(
      future: Future.value('Hello World!'),
      onData: (context, data) => Text(data),
      onLoading: (context) => const Text('Loading...'),
      onError: (context, error, stackTrace) => Text('Error: $error'),
    );
  }
}

thenBuild extension #

import 'package:easy_future_builder/easy_future_builder.dart';

class HomePage extends StatelessWidget {
  const HomePage({super.key});
  
  @override
  Widget build(BuildContext context) {
    return Future.value('Hello World!').thenBuild(
      (context, data) => Text(data),
      onLoading: (context) => const Text('Loading...'),
      onError: (context, error, stackTrace) => Text('Error: $error'),
    );
  }
}

License #

MIT

0
likes
140
points
16
downloads

Publisher

verified publisherricardoboss.de

Weekly Downloads

Provides a better `FutureBuilder` experience.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on easy_future_builder