Skip to content
pubscout

conditional_builder_null_safety

0.0.6, released 5 years ago by an unverified publisher

Widget that shows builder or fallback based on a boolean condition

WASM-ready
$ flutter pub add conditional_builder_null_safety
Source repository

What it does

ConditionalBuilder displays a builder widget when the condition is true and a fallback widget when it is false. If fallback is null, it returns an empty container.

AI-written summary of version 0.0.6, based on the package's README and metadata. Report an inaccuracy

Use it when

  • When you need to show different UI based on a simple boolean condition
  • When you want a quick way to toggle between two widgets without writing if/else logic

Skip it when

  • When the condition depends on complex state that should be managed by a state management solution
  • When you need animations or transitions between the two widgets

Strengths

  • Simple API
  • Null safety support
  • Fallback can be omitted

Weaknesses

  • Very basic, no animation support
  • No documentation on performance or edge cases
  • No support for async conditions

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
0
```dart
ConditionalBuilder(
  condition: true,
  builder: (context) => Center(child: Text('this is true')),
  fallback: (context) => Center(child: Text('this is not true')),
)
```

Alternatives

Packages that do the same job and could replace conditional_builder_null_safety.