Loading topic
Intermediate · Mid: 16 chapters · 26 min read. States assumed prerequisites
Start readingasync/await. You should also know Flutter’s StatelessWidget, StatefulWidget, BuildContext, and setState. Later examples assume basic familiarity with streams.async/await. You should also know the basics of Flutter widgets and setState. This chapter uses the flutter_bloc package.BuildContext, and basic Cubit usage. It also assumes the flutter_bloc package is in your project.async code. It also assumes that you know Flutter widgets, BuildContext, and basic Bloc or Cubit usage.async/await, Flutter widgets, BuildContext, and the basic Cubit and Bloc APIs. It also assumes a TodosCubit with a TodosState containing a status such as initial, loading, success, or failure.async and await, null safety, Flutter widgets, BuildContext, and basic Bloc or Cubit usage. The goal is to represent every meaningful phase of asynchronous work in state, rather than hiding it inside a widget.async and await, Flutter widgets, and the basic Cubit pattern. A Cubit changes state when one of its public methods calls emit. A Bloc adds an event layer between the UI and the state change.BlocProvider exposes a state object to Flutter widgets. Both Cubit and Bloc separate state changes from the UI. The main difference is how those changes begin:async/await, Flutter widgets, and the basic Cubit and BlocProvider APIs. This chapter uses dependency injection, which means giving an object the dependencies it needs instead of creating those dependencies inside the object.async/await, Flutter testing basics, and how Cubits and Blocs expose state. The examples use the bloc, flutter_bloc, bloc_test, and flutter_test packages.Bloc classes. A concurrency transformer controls what happens when several events arrive before an earlier event finishes.async and await, and basic Flutter widget lifecycles. This chapter explains how Cubit and Bloc deliver state changes to widgets.async/await, Flutter widget lifecycles, and basic Bloc usage. This chapter shows how to compose several repositories and Blocs without constructing dependencies inside widgets.flutter_bloc APIs. A BlocObserver is a global hook for observing the lifecycle of every Cubit and Bloc in an application. It helps you understand when state changes, events are added, errors occur, and insta