Last active
October 1, 2021 09:35
-
-
Save enyo/5647960687d8c805dcd1c30055d54f28 to your computer and use it in GitHub Desktop.
This file contains 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
/// A channel that the gRPC libray communicates over. | |
/// This is provided by the gRPC library. | |
final channel = GrpcWebClientChannel.xhr(Uri.parse('https://your.api.url:8080')); | |
/// The class [AccountServiceClient] is generated by the gRPC library from | |
/// your `.proto` definition. | |
final client = AccountServiceClient(channel); | |
Future<void> changePassword() async { | |
/// The message you want to send to the API. It's also generated from your | |
/// `.proto` definition. | |
final request = | |
ChangePasswordRequest(oldPassword: 'old-pass', newPassword: 'new-pass'); | |
/// Simply call the `.changePassword()` method on your client as if it were | |
/// a local call, and you get the response from the server asynchronously. | |
/// | |
/// In this case the call doesn't return anything. | |
await client.changePassword(request); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment