meteorify 1.0.6

  • Readme
  • Changelog
  • Example
  • Installing
  • 75

Meteorify #


A Dart package to interact with the Meteor framework.

Connect your web or flutter apps, written in Dart, to the Meteor framework.

Features #

  • Connect to Meteor server
  • Use Meteor Subscriptions
  • Meteor Authentication
  • Call custom Methods on Meteor
  • Access underlying databases

Dependency #

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

  meteorify: ^1.0.6

Usage #

Capturing the result of operations #

You can use either the then-catchError or await syntax to capture the result of operations and handle errors.

I'll be using the await syntax in this documentation to keep it short and straight. You can use either catchError on Future object or try/catch syntax to catch errors.

Connection Operations #

Connecting with Meteor

Using then-catchError:

import 'package:meteorify/meteorify.dart';

main() async{
          // Do something after connection is successful
          //Handle error

Using await:

import 'package:meteorify/meteorify.dart';

main() async{
      var status = await Meteor.connect('ws://');
      // Do something after connection is successful
      //Handle error

Check connection status

var isConnected = Meteor.isConnected;		

Disconnect from server


Listen for connection updates

Meteor.connectionListener = (ConnectionStatus connectionStatus){

Subscriptions #

Subscribe to Data

var subscriptionId = await Meteor.subscribe(subscriptionName);

Subscriptions with Parameters

var subscriptionId = await Meteor.subscribe(subscriptionName,args:[arg1,arg2]);

Unsubscribe from Data

await Meteor.unsubscribe(subscriptionId);

Get subscribed data/collection

SubscribedCollection collection = await Meteor.collection(collectionName);

Authentication #

Creating New Account

var userId = await Accounts.createUser(username,email,password,profileOptions);


  1. Login with password

    String loginToken = await Meteor.loginWithPassword(email,password);
  2. Login with token

    String token = await Meteor.loginWithToken(loginToken);
  3. Change Password (need to be logged in)

    String result = await Accounts.changePassword(oldPassword,newPassword);
  4. Forgot Password

    String result = await Accounts.forgotPassword(email);
  5. Reset Password

    String result = await Accounts.resetPassword(resetToken,newPassword);
  6. Logout

    await Meteor.logout();
  7. Get logged in userId

    String userId = Meteor.currentUserId;
  8. Check if logged in

    bool isLoggedIn = Meteor.isLoggedIn();
  9. Get current user as map

    Map<String,dynamic> currentUser = await Meteor.userAsMap();

Call Custom Methods #

Defining custom methods in meteor server

export const helloWorld = new ValidatedMethod({
  name: 'hello',
  validate: new SimpleSchema({
    firstname: {type: String},
    lastname: {type: String},
  run({ firstname,lastname }) {
    const message = "hello "+firstname+" "+lastname;
    return message;

Invoking custom methods

  var result = await'hello',[{'firstname':'Shivam','lastname':'Arora'}]);

Using Mongo Databases to manage data #

Meteorify uses the mongo_dart package internally to provide access to actual database.

For more instructions regarding use of mongo_dart , visit their mongo_dart guide.

Get Meteor Database

import 'package:mongo_dart/mongo_dart.dart';

Db db = await Meteor.getMeteorDatabase();

Get custom database

import 'package:mongo_dart/mongo_dart.dart';

Db db = await Meteor.getCustomDatabase(dbUrl);

Get collection

import 'package:mongo_dart/mongo_dart.dart';

DbCollection collection = await db.collection('collectionName');

1.0.6 #

  • Implemented dart analysis suggestions for better maintenance.

  • Upgraded mongo_dart to version 0.4.0.

1.0.5 #

  • Now you can pass parameters to subscriptions. Use the following syntax:

    int subscriptionId = await Meteor.subscribe(subscriptionName, args=[arg1,arg2]);
  • You can provide a custom db port for the meteor database. Use the following syntax:

    await Meteor.connect("ws://", dbPort: 4001);

1.0.4 #

  • Updated mongo_dart to provide Dart 2.5 compatibility.

1.0.3 #

  • Fixed the future already completed on status changed bug.

  • Now, you can set a listener for the connection events.

    • Meteor.connectionListener = (ConnectionStatus connectionStatus){
  • You can now provide a custom interval for checking the status of the server by specifying heartbeatInterval within Meteor.connect()

  • You can now enable autoLoginOnReconnect to re-login the currently logged in user whenever the connection reconnects after a disconnection.

1.0.2 #

  • Provided a method to call serviceMethods exported from Meteor using
  • Provided documentation for most of the classes and methods.

1.0.1 #

  • Improve package health and fix analysis issues

1.0.0 #

  • Initial version, created by ShivamArora
  • Features
    • Connect to Meteor server
    • Use Meteor Subscriptions
    • Meteor Authentication
    • Call Custom Methods on Meteor
    • Access underlying databases


import 'package:meteorify/meteorify.dart';

main() {


Use this package as a library

1. Depend on it

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

  meteorify: ^1.0.6

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:meteorify/meteorify.dart';
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 Feb 27, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.5

Health suggestions

Format lib/src/meteor/meteor.dart.

Run dartfmt to format lib/src/meteor/meteor.dart.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
ddp ^0.0.13 0.0.13
mongo_dart ^0.4.0 0.4.0
Transitive dependencies
async 2.4.0
bson 0.3.2
charcode 1.1.3
collection 1.14.12
convert 2.1.1
crypto 2.1.4
fixnum 0.10.11
logging 0.11.4
matcher 0.12.6
meta 1.1.8
mongo_dart_query 0.4.1
more 1.18.2 2.2.0
path 1.6.4
pool 1.4.0
quiver 2.1.2+1
stack_trace 1.9.3
tuple 1.0.3
typed_data 1.1.6
uuid 2.0.4
Dev dependencies
pedantic ^1.0.0
test ^1.0.0