Skip to content

Instantly share code, notes, and snippets.

@gistlyn
Created December 30, 2019 10:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gistlyn/aff6dbb58521d364c9a84aea7ea0647f to your computer and use it in GitHub Desktop.
Save gistlyn/aff6dbb58521d364c9a84aea7ea0647f to your computer and use it in GitHub Desktop.
Dart Google protoc SSL GrpcServicesClient TodoWorld Example
import 'dart:io';
import 'package:grpc/grpc.dart';
import 'package:TodoWorld/services.pb.dart';
import 'package:TodoWorld/services.pbgrpc.dart';
void main(List<String> args) async {
var client = GrpcServicesClient(ClientChannel('todoworld.servicestack.net', port:50051,
options:ChannelOptions(credentials: ChannelCredentials.secure(
certificates: File('grpc.crt').readAsBytesSync(),
authority: 'todoworld.servicestack.net'))));
var response = await client.getHello(Hello()..name = 'gRPC Dart');
print(response.result);
exit(0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment