buildWhenTrue method
ValueListenable listener widget that only build if value is true
Implementation
Widget buildWhenTrue(Widget Function() builder, {Widget? onFalse}) {
return ValueListenableBuilder<bool>(
valueListenable: this,
builder: (context, value, child) {
if (value == true) return builder();
return onFalse ?? const SizedBox.shrink();
},
);
}