onBuilder method

T onBuilder(
  1. T fn(
    1. BuildContext context
    )
)

Creates a variant using a builder function that receives the build context.

Implementation

T onBuilder(T Function(BuildContext context) fn) {
  // Create a VariantStyle with ContextVariantBuilder that will be resolved at runtime
  // Use this style as a placeholder; the actual style comes from the builder function
  return variants([VariantStyle<S>(ContextVariantBuilder<T>(fn), this)]);
}