builder property

TransitionBuilder? builder
final

Syntax sugar for obtaining a BuildContext that can read the provider created.

This code:

Provider<int>(
  create: (context) => 42,
  builder: (context, child) sync* {
    final value = context.watch<int>();
    yield Text('$value');
  }
)

is strictly equivalent to:

Provider<int>(
  create: (context) => 42,
  child: Builder(
    builder: (context) sync* {
      final value = context.watch<int>();
      yield Text('$value');
    },
  ),
)

For an explanation on the child parameter that builder receives, see the "Performance optimizations" section of fluter's AnimatedBuilder.

Implementation

final TransitionBuilder? builder;