If you refer to the bloc package created by Felix Angelov you don't necessarily need to use rx_dart, but you could.
For instance you can apply some of the rx_dart operators, such as switchMap, where, debounce, throttle etc on the transformEvents and/or transformTransitions. In that way you can manipulate the events, which are coming to the bloc (for instance applying back pressure, which will avoid overloading the server with too many requests)
Bloc lifecycle
In case you want to take the full advantage of the reactive streams, you could explore the rx_bloc eco system, which is an implementation of the Business Logic Component pattern that embraces rx_dart.
Basically you need to declare the contracts of a particular feature, and then to implement the bloc, which is compliant with it in reactive manner. For instance if you need to fetch some news from an API you need to declare the contracts in this way:
/// A contract, containing all News BloC incoming events
abstract class NewsBlocEvents {
/// Send a search event to the bloc with some payload
void search({required String query});
}
/// A contract, containing all News BloC states
abstract class NewsBlocStates {
/// The news found by the search query
///
/// It can be controlled by executing [NewsBlocStates.search]
///
Stream<Result<List<News>>> get news;
}
Now when all contracts are defined, you need to implement the Reactive BloC
/// A BloC responsible for the news
@RxBloc()
class NewsBloc extends $NewsBloc {
/// The default constructor injecting a repository through DI
NewsBloc(this._repository);
/// The repository used for data source communication
final NewsRepository _repository;
/// Your events-to-sate business logic
@override
Stream<Result<List<News>>> _mapToNewsState() =>
_$searchEvent
/// Here you can apply any of the rx_dart operators
/// for instance, you can apply back pressure
.debounceTime(Duration(seconds: 1))
/// Then you get the data from the repository
.switchMap((_) =>
_repository.decrement().asResultStream(),
);
}
Once you have your business logic implemented, you can access the bloc within a widget tree by using flutter_rx_bloc. There are plenty of articles and examples, where you can learn how to use this eco system.