sponge_grpc_client_dart 1.13.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 41

Sponge gRPC client for Dart.

This is the Sponge gRPC API client for Dart.

See example/example.dart.

For more information on Sponge see https://sponge.openksavi.org.

Notes #

This project uses the Dart implementation of gRPC and doesn't support the web platform.

1.13.0 (2019-10-30) #

  • Dependencies upgrade.

1.12.0 (2019-09-30) #

  • The gRPC client allows an explicit service port configuration.
  • Fixed the gRPC default port resolving.
  • Fixed the gRPC request header.
  • Dependencies upgrade.

1.11.0 (2019-07-11) #

  • The initial release, compatible with Sponge 1.11.x.

example/example.dart

// Copyright 2019 The Sponge authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import 'package:grpc/grpc.dart';
import 'package:sponge_client_dart/sponge_client_dart.dart';
import 'package:sponge_grpc_client_dart/sponge_grpc_client_dart.dart';

void main() async {
  // Create a new Sponge REST API client.
  var restClient = SpongeRestClient(
      SpongeRestClientConfiguration('http://localhost:8888/sponge.json/v1'));

  // Create a new Sponge gRPC API client associated with the REST API client.
  // Don't use insecure channel in production.
  var grpcClient = SpongeGrpcClient(restClient,
      channelOptions:
          ChannelOptions(credentials: const ChannelCredentials.insecure()));

  // Get the Sponge version.
  var version = await grpcClient.getVersion();

  print('Version: $version');

  // Close the client connection.
  await grpcClient.close();
}

Use this package as a library

1. Depend on it

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


dependencies:
  sponge_grpc_client_dart: ^1.13.0

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

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

  • Dart: 2.6.1
  • pana: 0.12.21

Health suggestions

Fix lib/src/generated/sponge.pbjson.dart. (-19.79 points)

Analysis of lib/src/generated/sponge.pbjson.dart reported 44 hints, including:

line 7 col 26: Avoid const keyword.

line 9 col 8: Avoid const keyword.

line 10 col 5: Avoid const keyword.

line 18 col 5: Avoid const keyword.

line 28 col 8: Avoid const keyword.

Fix lib/src/generated/google/protobuf/any.pbjson.dart. (-1.99 points)

Analysis of lib/src/generated/google/protobuf/any.pbjson.dart reported 4 hints:

line 7 col 18: Avoid const keyword.

line 9 col 8: Avoid const keyword.

line 10 col 5: Avoid const keyword.

line 11 col 5: Avoid const keyword.

Fix lib/src/generated/google/protobuf/timestamp.pbjson.dart. (-1.99 points)

Analysis of lib/src/generated/google/protobuf/timestamp.pbjson.dart reported 4 hints:

line 7 col 24: Avoid const keyword.

line 9 col 8: Avoid const keyword.

line 10 col 5: Avoid const keyword.

line 11 col 5: Avoid const keyword.

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).

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.0 <3.0.0
grpc ^2.1.2 2.1.3
logging ^0.11.3+2 0.11.3+2
protobuf ^0.13.15 0.13.16+1 1.0.1
sponge_client_dart ^1.13.0 1.13.0
sync ^0.2.0 0.2.0
Transitive dependencies
async 2.4.0
charcode 1.1.2
collection 1.14.12
convert 2.1.1
crypto 2.1.4
fixnum 0.10.11
googleapis_auth 0.2.11
http 0.12.0+2
http2 1.0.0
http_parser 3.1.3
intl 0.16.0
matcher 0.12.6
meta 1.1.8
path 1.6.4
quiver 2.1.2+1
source_span 1.5.5
stack_trace 1.9.3
string_scanner 1.0.5
synchronized 2.1.1
term_glyph 1.1.0
timezone 0.5.6
typed_data 1.1.6
Dev dependencies
pedantic ^1.8.0+1 1.9.0
test ^1.9.3