This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| _messagesBloc = MessagesBloc( | |
| Provider.of<MessagesRepository>(context), | |
| Provider.of<RestClient>(context), | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class MessagesBloc { | |
| MessagesBloc( | |
| this._repository, | |
| this._restClient, | |
| ); | |
| final MessagesRepository _repository; | |
| final RestClient _restClient; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @override | |
| Widget build(BuildContext context) => MultiProvider( | |
| providers: [ | |
| Provider<RestClient>.value(value: _restClient), | |
| Provider<MessagesRepository>.value(value: _messagesRepository), | |
| Provider<ThreadDataLayer>.value( | |
| value: ApiThreadDataLayer( | |
| _restClient, | |
| () => _imageUrlProvider.baseImageUrl().first, | |
| ), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| dependencies: | |
| provider: ^3.0.0+1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class AuthenticationManager { | |
| AuthenticationManager(this._restClient); | |
| final RestClient _restClient; | |
| Future<Either<Exception, void>> logOut() => | |
| _restClient.signOut(SignOutRequest()).toEither(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @RestApi() | |
| abstract class RestClient { | |
| factory RestClient(Dio dio) = _RestClient; | |
| @POST('/api/general/v1/users/signOut') | |
| Future<EmptyResponse> signOut(@Body() SignOutRequest request); | |
| } | |
| @JsonSerializable() | |
| class EmptyResponse { … } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| dependencies: | |
| dio: ^3.0.7 | |
| retrofit: ^1.0.1+1 | |
| retrofit_generator: ^1.0.1+1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| final Response<Map<String, dynamic>> _result = await _dio.request(…); | |
| final value = MessageDto.fromJson(_result.data); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @JsonSerializable() | |
| class MessageDto { | |
| MessageDto({this.id, this.createdUtc, this.text, this.creator}); | |
| final String id; | |
| final String createdUtc; | |
| final String text; | |
| final MessageAuthorDto creator; | |
| static MessageDto fromJson(Map<String, dynamic> json) => |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| dependencies: | |
| json_annotation: ^3.0.1 | |
| json_serializable: ^3.2.5 |