buildFromStream method
Widget
buildFromStream({
- DataServiceWidgetBuilder<
X> ? builder, - dynamic key,
- bool isSliver = false,
- bool crossFade = true,
- bool allowNull = false,
- SimpleWidgetBuilder loading = kLoader,
Implementation
Widget buildFromStream(
{DataServiceWidgetBuilder<X>? builder,
key,
bool isSliver = false,
bool crossFade = true,
bool allowNull = false,
SimpleWidgetBuilder loading = kLoader}) {
final service = this;
return StreamBuilder<X>(
key: key is Key ? key : Key("${X}${key ?? 'StreamBuilder'}"),
stream: service.stream
.asBroadcastStream()
.where((event) => event != null)
.cast(),
builder: (context, snapshot) => snapshot.render(
context,
isSliver: isSliver,
crossFade: crossFade,
allowNull: allowNull,
successFn: (X data) {
return builder!(data, service);
},
loadingFn: loading,
),
initialData: this.currentValue,
);
}