Skip to content

Instantly share code, notes, and snippets.

@enyo
Last active Oct 1, 2021
Embed
What would you like to do?
/// 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