flutter_causality 0.0.2 flutter_causality: ^0.0.2 copied to clipboard
Flutter extensions for the causality Dart package. Easily observe causes in your widget tree.
flutter_causality #
Motivation #
I wanted to provide some convenience extensions for using causality
with
Flutter.
Supported Features #
- ✅ Put a causality universe widget in the wigdet tree
- ✅ Put an effect widget in the widget tree to observe causes
Installation #
As simple as dart pub add flutter_causality
.
Or manually add flutter_causality: ^<version>
to your pubspec.yaml
.
Examples #
runApp(
CausalityUniverseWidget(
causalityUniverse: causalityUniverse,
child: MaterialApp(
home: Scaffold(
body: EffectWidget(
builder: (cause) => switch (cause) {
ViewModelUpdatedCause _ => Center(
child: Text(cause.viewModel.data ?? ''),
),
_ => const Center(
child: CircularProgressIndicator(),
),
},
observedCauseTypes: const [
ViewModelUpdatedCause,
],
),
),
),
),
);