hprose 3.0.0

  • README.md
  • Example
  • Installing
  • Versions
  • 50


Hprose 3.0 for Dart #

Join the chat Build Status Pub

Hprose is a High Performance Remote Object Service Engine.

It is a modern, lightweight, cross-language, cross-platform, object-oriented, high performance, remote dynamic communication middleware. It is not only easy to use, but powerful. You just need a little time to learn, then you can use it to easily construct cross language cross platform distributed application system.

Hprose supports many programming languages, for example:

  • AAuto Quicker
  • ActionScript
  • ASP
  • C++
  • Dart
  • Delphi/Free Pascal
  • dotNET(C#, Visual Basic...)
  • Golang
  • Java
  • JavaScript
  • Node.js
  • Objective-C
  • Perl
  • PHP
  • Python
  • Ruby
  • ...

Through Hprose, You can conveniently and efficiently intercommunicate between those programming languages.

This project is the implementation of Hprose for Dart.

3.0.0-beta.1 #

  • Initial version, created by andot

3.0.0-beta.2 #

  • Fixed some hints.
  • Added CHANGELOG.md.

3.0.0-beta.3 #

  • Fixed some hints.

3.0.0-beta.4 #

  • Fixed some hints.
  • Added flutter, web and other platforms support.


library hprose_example;

import 'dart:async';
import 'dart:io';
import 'package:hprose/hprose.dart';

String hello(String name) {
  return 'hello $name';

Future<int> sum(int a, int b, [int c = 0, int d = 10]) async {
  await Future.delayed(new Duration(milliseconds: 1));
  return a + b + c + d;

String getAddress(String name, ServiceContext context) {
  return '$name : ${context.host}';

class User {
  String name;
  int age;
  bool male;
  User([this.name, this.age, this.male]);
  factory User.fromJson(Map<String, dynamic> json) {
    return new User(json['name'], json['age'], json['male']);
  Map<String, dynamic> toJson() =>
      {'name': this.name, 'age': this.age, 'male': this.male};

User createUser(String name, {int age, bool male, Context context}) {
  final serviceContext = context as ServiceContext;
  return new User(name, age, male);

void main() async {
  TypeManager.register((data) => User.fromJson(data),
      {'name': String, 'age': int, 'male': bool});
  final service = new Service();
  final server = await HttpServer.bind('', 8000);
  final client = new Client(['']);
  final proxy = client.useService();
  print(await proxy.hello<String>('world'));
  final r1 = proxy.sum<int>(1, 2);
  final r2 = proxy.sum<int>(1, 2, 3);
  print(await proxy.sum<int>(r1, r2, 3, 4));
  print(await proxy.getAddress<String>('localhost'));
  User user = await proxy.createUser<User>('张三', age: 18, male: true);

Use this package as a library

1. Depend on it

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

  hprose: ^3.0.0

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter packages get

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

3. Import it

Now in your Dart code, you can use:

import 'package:hprose/hprose.dart';
Version Uploaded Documentation Archive
3.0.0 Mar 10, 2019 Go to the documentation of hprose 3.0.0 Download hprose 3.0.0 archive
3.0.0-beta.4 Mar 10, 2019 Go to the documentation of hprose 3.0.0-beta.4 Download hprose 3.0.0-beta.4 archive
3.0.0-beta.3 Mar 9, 2019 Go to the documentation of hprose 3.0.0-beta.3 Download hprose 3.0.0-beta.3 archive
3.0.0-beta.2 Mar 9, 2019 Go to the documentation of hprose 3.0.0-beta.2 Download hprose 3.0.0-beta.2 archive
3.0.0-beta.1 Mar 9, 2019 Go to the documentation of hprose 3.0.0-beta.1 Download hprose 3.0.0-beta.1 archive
0.5.0-dev+2.25.2016 Feb 15, 2016 Go to the documentation of hprose 0.5.0-dev+2.25.2016 Download hprose 0.5.0-dev+2.25.2016 archive
0.3.3-dev+3.3.2015 Mar 4, 2015 Go to the documentation of hprose 0.3.3-dev+3.3.2015 Download hprose 0.3.3-dev+3.3.2015 archive
0.2.12-dev+2.12.2014 Feb 12, 2014 Go to the documentation of hprose 0.2.12-dev+2.12.2014 Download hprose 0.2.12-dev+2.12.2014 archive
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 Mar 10, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.2.0
  • pana: 0.12.14


Detected platforms: Flutter, web, other

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


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