buildWithContext method
Widget
buildWithContext({
- DataServiceWidgetBuilderWithContext<
X?> ? builder, - String? key,
- bool allowNull = false,
- bool isSliver = false,
- bool crossFade = true,
- SimpleWidgetBuilder? loading,
Implementation
Widget buildWithContext(
{DataServiceWidgetBuilderWithContext<X?>? builder,
String? key,
bool allowNull = false,
bool isSliver = false,
bool crossFade = true,
SimpleWidgetBuilder? loading}) {
final service = this;
return StreamBuilder<X>(
key: Key("${X}${key ?? 'StreamBuilder'}"),
stream: service.stream.where((event) => event != null).cast(),
initialData: service.currentValue,
builder: (context, snapshot) => snapshot.render(
context,
allowNull: allowNull,
crossFade: crossFade,
isSliver: isSliver,
builder: (input, loader) {
if (input != null || allowNull) {
return builder!(context, input, service);
} else {
return loader();
}
},
// successFn: (X data) {
// return builder!(context, data, service);
// },
),
);
}