http_extensions_protobuf 0.1.11

  • Readme
  • Changelog
  • Installing
  • 55

http_extensions : protobuf #

An [http extension] that serializes requests body to protobuf and deserializes responses's content from protobuf.

Usage #

final client = ExtendedClient(
  inner: Client(),
  extensions: [
    ProtobufExtension(logger: Logger("Protobuf"),
    defaultOptions: ProtobufOptions(
      contentType: "application/x-protobuf", // The value of the content type header sent to server.
      shouldDeserialize: (response) => response.statusCode >= 200 && response.statusCode < 300, // Indicates whether a response should be deserialized
      shouldSerialize: (request) => true, // Indicates whether a request should be serialized

// The new request will serialize requestMessage to body and responseMessage from response content
final proto = ProtobufOptions(
  requestMessage: HelloRequest(),
  responseMessage: HelloReply(),

final response = await client.postWithOptions(
  options: [proto],

if (response.statusCode == 200) {
  print("Reply: ${proto.responseMessage}");

0.1.11 #

  • Added conditional platform imports.

0.1.10 #

  • Fixed issue with content-length header
  • Working example

0.1.4 #

  • Fixed default encoding

0.1.1 #

  • Fixed issue with body serialization

0.1.0 #

  • Initial version

Use this package as a library

1. Depend on it

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

  http_extensions_protobuf: ^0.1.11

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:http_extensions_protobuf/http_extensions_protobuf.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

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

  • Dart: 2.5.1
  • pana: 0.12.21


Detected platforms: Flutter, web, other

No platform restriction found in primary library package:http_extensions_protobuf/http_extensions_protobuf.dart.

Health suggestions

Format lib/src/extension.dart.

Run dartfmt to format lib/src/extension.dart.

Format lib/src/request.dart.

Run dartfmt to format lib/src/request.dart.

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (protobuf).

Maintain an example.

None of the files in the package's example/ directory matches known example patterns.

Common filename patterns include main.dart, example.dart, and http_extensions_protobuf.dart. Packages with multiple examples should provide example/

For more information see the pub package layout conventions.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.0 <3.0.0
http ^0.12.0+1 0.12.0+2
http_extensions ^0.1.2 0.1.2
logging ^0.11.3 0.11.3+2
meta ^1.1.6 1.1.7
protobuf ^0.13.12 0.13.16+1 1.0.0
Transitive dependencies
async 2.4.0
charcode 1.1.2
collection 1.14.12
fixnum 0.10.9
http_parser 3.1.3
path 1.6.4
pedantic 1.8.0+1
source_span 1.5.5
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6