Test your Flutter BLoC knowledge with a free interactive quiz — 20 questions with answers and explanations. No signup needed to play.
Question 1/5Score 0
What is a reasonable justification for using `RepositoryProvider` to inject a repository into a Bloc's constructor, rather than having the Bloc directly instantiate its own repository internally?
Questions in this quiz
What is a reasonable justification for using `RepositoryProvider` to inject a repository into a Bloc's constructor, rather than having the Bloc directly instantiate its own repository internally?
What is `Cubit.stream` (or `Bloc.stream`), and what does exposing it as a raw `Stream<State>` let a developer do beyond using the standard BlocBuilder/BlocListener widgets?
Why might `context.read<T>()` throw an error if called from inside a widget's `build()` method in certain contexts, even though it's generally described as "safe" for one-off, non-subscribing access?
What does `BlocConsumer` provide that using a separate `BlocBuilder` and `BlocListener` (nested together) does not?
How does `BlocSelector` in flutter_bloc compare to plain `BlocBuilder`, in terms of rebuild optimization?
What does the `buildWhen`/`listenWhen` parameter on `BlocBuilder`/`BlocListener` let a developer control?
What widgets/classes does the `flutter_bloc` package provide beyond the core `Bloc`/`Cubit` base classes?
How does `BlocProvider.of<T>(context)` (or the shorthand `context.read<T>()`) let a widget access a Bloc provided higher up in the widget tree?
What is a reasonable way to think about the tradeoff between using plain `Bloc` (with explicit named events) versus `Cubit` (direct method calls) SPECIFICALLY within the flutter_bloc package, for a given feature?
What does `BlocProvider.value()` (analogous to `Provider.value()`) address, as distinct from the standard `BlocProvider(create: ...)` constructor?
What is a reasonable strategy for structuring a moderately complex screen in a flutter_bloc app that needs to both dispatch events based on user interaction AND react visually to resulting state changes?
What is the purpose of `HydratedBloc` (from the related `hydrated_bloc` package built on top of flutter_bloc)?