Update Blocs authored by Nicholas Sarian's avatar Nicholas Sarian
......@@ -19,10 +19,8 @@ on<SendCreatePlayerEvent>((event, emit) async {
```
In the above code, the bloc will be listening for a SendCreatePlayerEvent to be sent. Once the Bloc receives the SendCreatePlayerEvent, the asynchronous function will be called with an event object of type SendCreatePlayerEvent and the emit function, which is used to emit new states. The event object contains all of the information that was sent in the event
# Emitting a New State within Bloc
To emit a new state in Bloc, call the emit function with the new state. Example:
After the bloc gets the requested information from the repositories, a new CreateePlayerComplete state is created and emitted like this:
```dart
emit(CreatePlayerLoading());
emit(CreatePlayerComplete(response));
```
In the example above, the CreatePlayerLoading state is emitted. This state will be used later in widgets, where you can check what the current state of the page is.
\ No newline at end of file
In the example above, the CreatePlayerComplete state is emitted with the response from the repository. This state transition is later picked up by the page and it changes the page according to the response and what information the page request
\ No newline at end of file