Last updated:
0 purchases
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
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.