bloc property

B bloc

Returns the bloc that this component is reading from once the component has been mounted.

Implementation

B get bloc {
  assert(
    isMounted,
    'Cannot access the bloc instance before it has been mounted.',
  );
  return _bloc;
}
void bloc=(B bloc)

Explicitly set the bloc instance which the component will be listening to. This is useful in cases where the bloc being listened to has not be provided via FlameBlocProvider.

Implementation

set bloc(B bloc) {
  assert(
    _blocOverride == null,
    'Cannot update the bloc instance once it has been set.',
  );
  _blocOverride = bloc;
}