Update Flutter and Bloc Interactions Overview authored by Spencer Hooper's avatar Spencer Hooper
...@@ -7,7 +7,8 @@ ...@@ -7,7 +7,8 @@
# Flow of Interactions # Flow of Interactions
On the Dart page, when the UI requires information from the backend, an [Event](Events) is dispatched to the [Bloc](Blocs). The Bloc then creates a **Request** and passes it to a [Repository](Repository). The Repository then communicates with the [Restful Server](Restful Server) which uses [Controllers](Server Components#controllers) to accomplish the task for the request. On the Dart page, when the UI requires information from the backend, an [Event](Events) is dispatched to the [Bloc](Blocs). The Bloc then creates a [Request](Response and Requests#request) and passes it to a [Repository](Repository). The Repository then communicates with the [Restful Server](Restful Server) which uses [Controllers](Server Components#controllers) to accomplish the task for the request.
When the Server has completed its task, it sends a [Response](Response and Requests#response) back to the App, and the **Bloc** emits a specific **Event** depending on what the **Response** is (Often this is determined simply by whether the response is a success or a failure). This **Event** will carry the information from the **Response** and the **Bloc** event listener will update the **State** accordingly.
# Await # Await
...@@ -33,7 +34,7 @@ Future<LoginWithCredentialsResponse> loginPlayer(LoginWithCredentialsRequest req ...@@ -33,7 +34,7 @@ Future<LoginWithCredentialsResponse> loginPlayer(LoginWithCredentialsRequest req
As another example, the following code requests information about the majors and crews when creating a player: As an example, the following code requests information about the majors and crews when creating a player:
```dart ```dart
BlocProvider<GetMajorsAndCrewsBloc>( BlocProvider<GetMajorsAndCrewsBloc>(
create: (context) => GetMajorsAndCrewsBloc( create: (context) => GetMajorsAndCrewsBloc(
... ...
......