A build function returned null The offending widget is: StreamBuilder<Response>
If you don't need to render anything, don't use StreamBuilder
to begin with.StreamBuilder
is a helper widget used to display the content of a Stream
.
What you want is different. Therefore you can simply listen to the Stream
manually.
The following will do:
class Foo<T> extends StatefulWidget { Stream<T> stream; Foo({this.stream}); @override _FooState createState() => _FooState<T>();}class _FooState<T> extends State<Foo<T>> { StreamSubscription streamSubscription; @override void initState() { streamSubscription = widget.stream.listen(onNewValue); super.initState(); } void onNewValue(T event) { Navigator.of(context).pushNamed("my/new/route"); } @override void dispose() { streamSubscription.cancel(); super.dispose(); } @override Widget build(BuildContext context) { return Container(); }}