jsonrpc2flutter 1.0.0

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 69

jsonrpc2-flutter #

This project is a repackage of jsonrpc2-dart made to be compatible with Flutter.

The sdk has been upgraded to Dart 2 as it is now the default sdk for Flutter.

For more details please visit the original project.

Basic Usage #

  • Import the client library.
  • Create a ServerProxy with the url for the desired endpoint.
  • Call a method on that endpoint, error check, and do something with the result.
    import 'package:jsonrpc2/jsonrpc_io_client.dart';
    proxy = ServerProxy('http://example.com/some_endpoint');
    proxy.call('some_method',[arg1, arg2])
         .then((returned)=>proxy.checkError(returned))
         .then((result){do_something_with(result);})
         .catchError((error){handle(error);});

Credit #

All credit to jwashin for the original implementation, only minor changes were needed to ensure Flutter compatibility.

[1.0.0] - 2018-09-10

Added #

  • Initial publication.

Use this package as a library

1. Depend on it

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


dependencies:
  jsonrpc2flutter: ^1.0.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:jsonrpc2flutter/client_base.dart';
import 'package:jsonrpc2flutter/jsonrpc_io_client.dart';
import 'package:jsonrpc2flutter/rpc_exceptions.dart';
  
Version Uploaded Documentation Archive
1.0.0 Sep 10, 2018 Go to the documentation of jsonrpc2flutter 1.0.0 Download jsonrpc2flutter 1.0.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
46
Health:
Code health derived from static analysis. [more]
94
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
69
Learn more about scoring.

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

  • Dart: 2.3.1
  • pana: 0.12.17

Platforms

Detected platforms: Flutter, other

Platform components identified in package: io.

Health issues and suggestions

Document public APIs. (-1 points)

75 out of 75 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/client_base.dart. (-4.41 points)

Analysis of lib/client_base.dart reported 9 hints, including:

line 34 col 19: Don't explicitly initialize variables to null.

line 42 col 17: Don't explicitly initialize variables to null.

line 54 col 7: DO use curly braces for all flow control structures.

line 94 col 17: Don't explicitly initialize variables to null.

line 106 col 19: Don't explicitly initialize variables to null.

Fix lib/rpc_exceptions.dart. (-0.50 points)

Analysis of lib/rpc_exceptions.dart reported 1 hint:

line 25 col 55: Don't explicitly initialize variables to null.

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

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

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0