Commit 042130c8 authored by kevin's avatar kevin

remove experiment

parent 53d48af3
Pipeline #48760383 passed with stages
in 9 minutes and 17 seconds
......@@ -33,39 +33,3 @@ mixin StreamBuilderHelperMixin {
);
}
}
class StreamBuilderHelper<StreamType> extends StatefulWidget {
final Widget defaultWidget;
final Stream<StreamType> stream;
final Widget Function(BuildContext context, StreamType data) builder;
StreamBuilderHelper({
@required this.stream,
this.builder,
Widget defaultWidget,
Key key,
}) : assert(
StreamType == Widget || (StreamType != Widget && builder != null)),
defaultWidget = defaultWidget != null ? defaultWidget : Container(),
super(key: key);
@override
_StreamBuilderHelperState<StreamType> createState() =>
_StreamBuilderHelperState<StreamType>();
}
class _StreamBuilderHelperState<StreamType>
extends State<StreamBuilderHelper<StreamType>>
with StreamBuilderHelperMixin {
@override
Widget get defaultWidget => widget.defaultWidget;
@override
Stream<Widget> buildStream(BuildContext context) {
if (StreamType != Widget) {
return widget.stream.map((data) => widget.builder(context, data));
}
return widget.stream.cast<Widget>();
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment