bloc property Null safety

AutoDisposeProviderBase<T, T> bloc

Obtains the Bloc associated with this provider, but without listening to it.

Listening to this provider may cause providers/widgets to rebuild in the event that the Bloc it recreated.

It is preferrable to do:

instead of:

The reasoning is, using read could cause hard to catch bugs, such as not rebuilding dependent providers/widgets after using context.refresh on this provider.


late final AutoDisposeProviderBase<T, T> bloc =
    AutoDisposeProvider((ref) =>;