ddp 0.0.13

  • Readme
  • Changelog
  • Installing
  • 77

DDP #

This is a DPP protocol implementation for Flutter/Dart.

Getting Started #

Install #

Add the package to your project using these instructions.
For help getting started with Flutter, view our online documentation.
For help on editing package code, view the documentation.

Connection #

import 'package:ddp/ddp.dart';

DdpClient client = DdpClient("meteor", "ws://localhost:3000/websocket", "meteor");
client.connect();

client.addStatusListener((status) {
  if (status == ConnectStatus.connected) {
    print('I am connected!');
  }
});

Subscribe #

void myListener(String collectionName, String message, String docId, Map map) {
  // Do something great
}

client.addStatusListener((status) {
  if (status == ConnectStatus.connected) {
    client.subscribe("subscribe_name", (done) {
      Collection collection = done.owner.collectionByName("collection_name");
      collection.addUpdateListener(myListener);
    }, []);
  }
});

Call method #

List tasks = [];

client.addStatusListener((status) async {
  if (status == ConnectStatus.connected) {
    var data = await client.call('getTasks', []);
    data.reply.forEach((map) => tasks.add(map));
  }
});

License #

Copyright (c) 2018 haoguo

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

[0.0.13]

  • Add missing type parameter

[0.0.12]

  • Add removeStatusListener for DdpClient

[0.0.11]

  • Remove ddp_ejson.dart file.

[0.0.10]

  • Remove dependency sprintf now. Use int.toRadixString instead.
  • Remove dependency mutex now. The previously use in sync code which is meaningless.
  • Merged bobagold's pull request.

[0.0.9] - Add NO sub

  • Add No Sub implementation of meteor DDP

[0.0.1] - TODO: Add release date.

  • TODO: Describe initial release.

Use this package as a library

1. Depend on it

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


dependencies:
  ddp: ^0.0.13

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

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

  • Dart: 2.6.0
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, other

Primary library: package:ddp/ddp.dart with components: io.

Health issues and suggestions

Document public APIs. (-0.10 points)

157 out of 162 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/ddp_client.dart. (-1 points)

Analysis of lib/ddp_client.dart reported 2 hints:

line 43 col 10: The value of the field '_serverId' isn't used.

line 46 col 10: The value of the field '_origin' isn't used.

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

Analysis of lib/ddp.dart reported 1 hint:

line 26 col 12: The value of the field '_timeout' isn't used.

Format lib/ddp_collection.dart.

Run dartfmt to format lib/ddp_collection.dart.

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

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 ddp.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.8.0 <3.0.0
tuple ^1.0.2 1.0.3
Transitive dependencies
matcher 0.12.6
meta 1.1.8
path 1.6.4
quiver 2.1.2+1
stack_trace 1.9.3
Dev dependencies
test ^1.3.0