grpc 2.1.3

  • Readme
  • Changelog
  • Example
  • Installing
  • 94

The Dart implementation of gRPC: A high performance, open source, general RPC framework that puts mobile and HTTP/2 first.

Build Status pub package

Usage #

See the Dart gRPC Quickstart.

grpc-web in a browser context is supported by package:grpc/grpc_web.dart.

Status #

If you experience issues, or if you have feature requests, please open an issue.

Note that we have limited bandwidth to accept PRs, and that all PRs will require signing the EasyCLA.

Notes #

This library requires Dart SDK version 2.2.0 or later.

It currently supports the Flutter and Dart native platforms.

2.1.3 #

  • Fix bug in grpc-web when receiving an empty trailer.
  • Fix a state bug in the server.

2.1.2 #

  • Fix bug introduced in 2.1.1 where the port would be added to the default authority when making a secure connection.

2.1.1 #

  • Fix bug introduced in 2.1.0 where an explicit authority would not be used when making a secure connection.

2.1.0 #

  • Do a health check of the http2-connection before making request.
  • Introduce ChannelOptions.connectionLimit the longest time a single connection is used for new requests.
  • Use Tcp.nodelay to improve client call speed.
  • Use SecureSocket supportedProtocols to save a round trip when establishing a secure connection.
  • Allow passing http2 ServerSettings to Server.serve.

2.0.3 #

  • GrpcError now implements Exception to indicate it can be reasonably handled.

2.0.2 #

  • Fix computation of the audience given to metadata providers to include the scheme.

2.0.1 #

  • Fix computation of authority. This should fix authorization.

2.0.0+1 #

  • Fix imports to ensure grpc-web.dart has no accidental transitive dependencies on dart:io.

2.0.0 #

  • Add initial support for grpc-web. See example/grpc-web for an example of this working.
  • Breaking: grpc.dart no longer exposes ClientConnection. It was supposed to be an internal abstraction.
  • Breaking: grpc.dart no longer exposes the deprecated ServerHandler. It was supposed to be an internal abstraction.
  • service_api.dart no longer exports Server - it has never been used by the generated code.

1.0.3 #

  • Allow custom user agent with a userAgent argument for ChannelOptions().
  • Allow specifying authority for ChannelCredentials.insecure().
  • Add userAgent as an optional named argument for clientConnection.createCallHeaders().

1.0.2 #

  • Fix bug where the server would crash if the client would break the connection.

1.0.1 #

  • Add service_api.dart that only contains the minimal imports needed by the code generated by protoc_plugin.

1.0.0+1 #

  • Support package:http2 1.0.0.

1.0.0 #

  • Graduate package to 1.0.

0.6.8+1 #

  • Removes stray files that where published by accident in version 0.6.8.

0.6.8 #

  • Calling terminate() or shutdown() on a channel doesn't throw error if the channel is not yet open.

0.6.7 #

  • Support package:test 1.5.

0.6.6 #

  • Support package:http >=0.11.3+17 <0.13.0.
  • Update package:googleapis_auth to ^0.2.5+3.

0.6.5 #

  • Interceptors are now async.

0.6.4 #

  • Update dependencies to be compatible with Dart 2.

0.6.3 #

  • Make fields of StatusCode const rather than final.

0.6.2 #

  • Allow for non-ascii header values.

0.6.1 #

  • More fixes to update to Dart 2 core library APIs.

0.6.0+1 #

  • Updated implementation to use new Dart 2 APIs using dart2_fix.

0.6.0 #

  • Dart SDK upper constraint raised to declare compatability with Dart 2.0 stable.

0.5.0 #

  • Breaking change: The package now exclusively supports Dart 2.
  • Fixed tests to pass in Dart 2.
  • Added support for Interceptors (issue #79); thanks to @mogol for contributing!

0.4.1 #

  • Fixes for supporting Dart 2.

0.4.0 #

  • Moved TLS credentials for server into a separate class.
  • Added support for specifying the address for the server, and support for serving on an ephemeral port.

0.3.1 #

  • Split out TLS credentials to a separate class.

0.3.0 #

  • Added authentication metadata providers, optimized for use with Google Cloud.
  • Added service URI to metadata provider API, needed for Json Web Token generation.
  • Added authenticated cloud-to-prod interoperability tests.
  • Refactored connection logic to throw initial connection errors early.

0.2.1 #

  • Updated generated code in examples using latest protoc compiler plugin.
  • Dart 2.0 fixes.
  • Changed license to Apache 2.0.

0.2.0 #

  • Implemented support for per-RPC metadata providers. This can be used for authentication providers which may need to obtain or refresh a token before the RPC is sent.

0.1.0 #

The API is shaping up, but may still change as more advanced features are implemented.

0.0.1 #

  • Initial version.

This package is in a very early and experimental state. We do not recommend using it for anything but experiments.

example/README.md

Four code examples are available:

  1. /helloworld/: A demonstration of using the Dart gRPC library to perform unary RPs.

  2. /googleapis/: A demonstration of using the Dart gRPC library to communicate with Google APIs.

  3. /metadata/: A demonstration of how to handle custom metadata, cancellation, and timeouts in Dart gRPC.

  4. /route_guide/: A demonstration of how to perform unary, client streaming, server streaming and full duplex RPCs.

For a complete, step-wise working example, see the Dart gRPC Quickstart.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  grpc: ^2.1.3

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:grpc/grpc.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
94
Health:
Code health derived from static analysis. [more]
89
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
94
Learn more about scoring.

We analyzed this package on Dec 11, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.1+4

Health suggestions

Fix lib/src/auth/rsa.dart. (-7.24 points)

Analysis of lib/src/auth/rsa.dart reported 15 hints, including:

line 33 col 51: Avoid const keyword.

line 55 col 17: Unnecessary new keyword.

line 71 col 22: Unnecessary new keyword.

line 103 col 13: Unnecessary new keyword.

line 106 col 16: Unnecessary new keyword.

Fix lib/src/client/http2_connection.dart. (-1.49 points)

Analysis of lib/src/client/http2_connection.dart reported 3 hints:

line 76 col 42: Avoid const keyword.

line 94 col 5: Future results in async function bodies must be awaited or marked unawaited using package:pedantic.

line 99 col 11: Unnecessary new keyword.

Fix lib/src/client/call.dart. (-1 points)

Analysis of lib/src/client/call.dart reported 2 hints:

line 333 col 5: Future results in async function bodies must be awaited or marked unawaited using package:pedantic.

line 334 col 5: Future results in async function bodies must be awaited or marked unawaited using package:pedantic.

Fix additional 4 files with analysis or formatting issues. (-2 points)

Additional issues in the following files:

  • lib/src/auth/auth.dart (1 hint)
  • lib/src/client/transport/http2_credentials.dart (1 hint)
  • lib/src/client/transport/xhr_transport.dart (1 hint)
  • lib/src/shared/security.dart (1 hint)

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.0 <3.0.0
async ^2.2.0 2.4.0
googleapis_auth ^0.2.7 0.2.11
http ^0.12.0 0.12.0+2
http2 ^1.0.0 1.0.0
meta ^1.1.6 1.1.8
Transitive dependencies
charcode 1.1.2
collection 1.14.12
convert 2.1.1
crypto 2.1.4
http_parser 3.1.3
path 1.6.4
pedantic 1.9.0
source_span 1.5.5
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
Dev dependencies
build_runner ^1.5.2
build_test ^0.10.8
build_web_compilers ^2.1.1
mockito ^4.1.0
test ^1.6.4