inherited_stream
An inherited widget for Streams, which updates its dependencies when the stream emits data.
- Stars
- 23
- Forks
- 2
- Last push (UTC)
- Mar 27, 2025
- Project status
- Active
Original README
English project snapshot. Visit GitHub for the latest content.
Inherited Stream
An InheritedWidget for Streams, which updates its dependencies when the Stream emits.
Usage
Create an InheritedStream
class ProgressModel extends InheritedStream<ValueStream<double>> {
const ProgressModel({
Key? key,
required ValueStream<double> stream,
required Widget child,
}) : super(key: key, stream: stream, child: child);
static double of(BuildContext context) {
return context
.dependOnInheritedWidgetOfExactType<ProgressModel>()!
.stream
.value!;
}
}
Insert into the Widget Tree
class _MyState extends State<MyPage> {
final _subject = BehaviorSubject<double>.seeded(0.0);
@override
void dispose() {
_subject.close();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: ProgressModel(
stream: _subject.stream,
child: Progress(),
),
floatingActionButton: FloatingActionButton(
onPressed: () => _subject.add(Random.nextDouble()),
),
);
}
}
Register Dependant(s)
class Progress extends StatelessWidget {
@override
Widget build(BuildContext context) {
return CircularProgressIndicator(value: ProgressModel.of(context));
}
}
LanguagesC++CMakeDartHTMLCSwiftKotlinObjective-C
Dependencies used
Dependency list 2 items
- flutter
{"sdk":"flutter"} - flutter_testDevelopment
{"sdk":"flutter"}
How do I choose a repository?
Start with your use case, compare repository activity, and check the original project before adopting it.
- Search by repository name, owner or description, then narrow the results by topic.
- Compare stars, forks and recent pushes. Stars show community interest, not a guarantee of quality.
- Read the README, license and issues on GitHub before using a project.
Sources and maintenance
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗
- felangel/inherited_stream · GitHub ↗
- GitHub Docs — Saving repositories with stars ↗
- Directory maintained by Ducafecat ↗