enhanced_ddp 1.0.9

  • Readme
  • Changelog
  • Example
  • Installing
  • new76

ENHANCED DDP #

Carefully extended DDP package to interact with the DDP. This is a DPP protocol implementation for Flutter/Dart.

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));
  }
});

1.0.8 #

  • Fixes removeUpdateListeners

1.0.8 #

  • Add Collection.removeUpdateListeners

1.0.7 #

  • Schedule reconnect on websocket onDone

1.0.6 #

  • Auto reconnect on connection lost

1.0.5 #

  • Change to WebSocketChannel

1.0.4 #

  • Change subscribe id

1.0.3 #

  • Analysis suggestions

1.0.2 #

  • Analysis suggestions

1.0.1 #

  • Analysis suggestions

1.0.0 #

  • Initial release

example/enhanced_ddp.dart

import 'package:enhanced_ddp/enhanced_ddp.dart';

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

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

Use this package as a library

1. Depend on it

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


dependencies:
  enhanced_ddp: ^1.0.9

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

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

  • Dart: 2.8.4
  • pana: 0.13.14

Health suggestions

Fix lib/enhanced_ddp_client.dart. (-1 points)

Analysis of lib/enhanced_ddp_client.dart reported 2 hints:

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

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

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

Analysis of lib/enhanced_ddp.dart reported 1 hint:

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

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.8.0 <3.0.0
tuple ^1.0.2 1.0.3
web_socket_channel ^1.1.0 1.1.0
Transitive dependencies
async 2.4.2
charcode 1.1.3
collection 1.14.13 1.15.0-nullsafety
convert 2.1.1
crypto 2.1.5
matcher 0.12.8
meta 1.2.2 1.3.0-nullsafety
path 1.7.0
quiver 2.1.3
stack_trace 1.9.5
stream_channel 2.0.0
typed_data 1.2.0 1.3.0-nullsafety
Dev dependencies
test ^1.3.0