flutter_fetcher_state

Last updated:

0 purchases

flutter_fetcher_state Image
flutter_fetcher_state Images
Add to Cart

Description:

flutter fetcher state

Flutter fetcher state #
Flutter library for fetching data
Query #
class ListItems extends Query<List<Item>> {
@override
Future<List<Item>> fetcher(BuildContext context) {
return Future.value([]);
}

@override
Stream<List<Item>> streamBuilder(BuildContext context) {
return const Stream.empty();
}
}
copied to clipboard
Query Builder #
Query.builder<List<String>>(
query: ListItems(),
builder: (context, controller) {
// handle your view with the controller
}
)
copied to clipboard
Mutation #
class AddItemMutation extends Mutation<Item> {
final Item item;

AddItemMutation({
required this.item,
});

@override
Future<Item> mutate(BuildContext context) async {
// add the item

return item;
}
}

copied to clipboard
Mutation Builder #
Mutation.builder<String>(
builder: (context, controller) {
return TextButton(
child: Text("Click me"),
onPressed: () => controller.mutate(
AddItemMutation(
item: Item(),
),
)
)
}
)
copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.