builder method
Simple builder without passing state.
Implementation
Widget builder(
Widget Function() builder, {
void Function()? initState,
void Function(SnapState<T?> state)? onSetState,
void Function()? onAfterBuild,
void Function()? dispose,
ShouldRebuild? shouldRebuild,
Object? Function()? watch,
String? debugPrintWhenRebuild,
String? tag,
}) {
SideEffects<T?>? sideEffects;
if (initState != null ||
onSetState != null ||
onAfterBuild != null ||
dispose != null) {
sideEffects = SideEffects<T?>(
initState: initState,
onSetState: onSetState,
onAfterBuild: onAfterBuild,
dispose: dispose,
);
}
return OnBuilder<T?>(
listenTo: this,
sideEffects: sideEffects,
shouldRebuild: (oldSnap, newSnap) {
final currentTag = currentNotificationTag;
if (tag != null && currentTag != null && tag != currentTag) {
return false;
}
return shouldRebuild?.call(oldSnap, newSnap) ?? true;
},
watch: watch,
debugPrintWhenRebuild: debugPrintWhenRebuild,
builder: builder,
);
}