falcor_dart 0.0.2

falcor_dart #

Build Status

This is Falcor router implementation for dart.

And as the falcor team states: This release is a developer preview.

Usage #

A simple usage example:

import 'package:falcor_dart/falcor_dart.dart';

main() {
  final router = new Router([
        // match a request for the key "greeting"
        // respond with a PathValue with the value of "Hello World."
        get: (path) {
          return {
            'path': ['greeting'],
            'value': 'Hello World'

More information #

For in-depth information on the Falcor Router, see the Router Guide in the Falcor Website.

Features and bugs #

This release contains all the issues and feature requests from falcor-router.

Please file feature requests and bugs at the issue tracker.

Changelog #

0.0.2 #

  • fix: Handle mixed numbers and Strings between path and returned path value
  • perf: Fix huge performance problem with many references
  • fix: NoSuchMethodError (NPE) when null/empty Future returned from handler

shelf #

  • fix: Internal Server Error on invalid JSON in paths paramater.

0.0.1 #

  • Initial version


library falcor_dart.example;

import 'package:shelf/shelf.dart' as shelf;
import 'package:shelf/shelf_io.dart' as io;

import 'package:falcor_dart/router.dart';
import 'package:falcor_dart/shelf.dart';

/// Example using shelf binding
main() async {
  final todoService = new TodosService();

  final falcorHandler = await createFalcorHandler((_) {
    return new Router([
      route('todos.name', get: (_) async {
        var todoList = await todoService.getTodoList();

        return {
          'path': ['todos', 'name'],
          'value': todoList.map((todo) => todo['name']),
      route('todos.length', get: (_) async {
        var todoList = await todoService.getTodoList();

        return {
          'path': ['todos', 'length'],
          'value': todoList.length,

  var handler = const shelf.Pipeline()

  var server = await io.serve(handler, 'localhost', 8080);

  print('Serving at http://${server.address.host}:${server.port}');

class TodosService {
  getTodoList() async {
    return [
      {'name': 'Create Router'},
      {'name': 'Create request handler'},
      {'name': 'Send requests'},

Use this package as a library

1. Depend on it

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

  falcor_dart: ^0.0.2

2. Install it

You can install packages from the command line:

with pub:

$ pub get

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

3. Import it

Now in your Dart code, you can use:

import 'package:falcor_dart/path_syntax.dart';
import 'package:falcor_dart/router.dart';
import 'package:falcor_dart/shelf.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.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://dart.dev/dart-2#migration.


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