select_when 1.0.1+1 select_when: ^1.0.1+1 copied to clipboard
A Flutter Provider extension: `selectWhen` to control when a selector should be invoked
example/select_when_example.dart
import 'package:flutter/material.dart';
import 'package:select_when/select_when.dart';
class SelectWhenExample extends StatelessWidget {
const SelectWhenExample({super.key});
@override
Widget build(BuildContext context) {
final name = context.selectWhen(
(Person person) => person.name,
when: (Person person) => !person.isLoading,
);
return Text(name);
}
}
class Person with ChangeNotifier {
String name = 'Skull Kid';
bool isLoading = false;
}