vane 0.8.2+1

  • Installing
  • Versions
  • 10


Vane is server side framework written and optimized for the Dart programming language. Vane comes bundled with a lightweight and performant middleware system and strives to provide commonly used parameters and objects in an easy to use manner such as query parameters or json body data.


  • Supports three handler types; Func, Podo and Vane
  • Class based, easy to make your own standard classes by extending any Podo or Vane class and adding your own behavior
  • Simple top level access to commonly used data such as query parameters, json body or file uploads
  • Out of the box websocket support
  • Any Vane class can run as the main controller or as a middleware
  • Middlewares can be defined to run synchronously or asynchronously, before or after the main controller
  • Built in "plug and play" support for Mongodb


Vane supports three different types of handlers:

  1. Vane handlers - Classes that extend the Vane class
  2. Podo handlers - "Plain Old Dart Objects", normal classes that have one or more functions with the @Route annotation
  3. Func handlers - Function handlers, normal dart function with the @Route annotation

Vane handler

A vane handler is any class that extends the Vane class. When you extend the Vane class your handler functions get access to many helpers and features that are part of the Vane framework. In a vane handler you have access to a set of top level helpers to make life easier, some example of these are a ready to use parsed version of incoming json data called "json".

A Vane class can either run on it's own or in a pipeline of a set of Vane controllers. When mulitple a Vane controller is used in a pipeline to process a request those other than the main controller are called middleware controllers, but it's not a different type of controller and middleware controllers can themself also have their own middleware controllers. Inside a Vane controller you can either end the controller by returning next() or close(), if you return with next() the next middleware controller will run (if there is one, otherwise the call will be changed to a close() call). If you call close() that will end the request even if there are middleware controllers that have yet not run.

Vane classes registered to as middleware can run either before or after the main controller. Middleware controllers can run synchronously or asynchronously and you are guaranteed that they execute in the order you define. Per default middleware controllers run synchronously and the next controller only starts when the current one has finished. You can choose to run one or more middleware controllers in async and also combine both a set of synchronous and asynchronous controller to create more complex pipelines for processing.

Hello World Example:

class HelloVane extends Vane {
  Future World() { 
    return close("Hello world! (from vane handler)");

Middleware Example:

class HelloVane extends Vane {
  var pipeline = [MyMiddleware, This]
  Future World() { 
    return close("Hello world! (from vane handler)");

class MyMiddleware extends Vane {
  Future main() { 
    write("Hello from middleware!");
    return next();

Podo handler

A podo handler is a "Plain Old Dart Object", basically any Dart class that have 1 or more function handlers with declared with the @Route annotation.

Hello World Example:

class HelloPodo {
  void World(HttpRequest request) {
    request.response.write("Hello World! (from podo handler)");

Func handler

A function handler is simple a function that takes at least 1 HttpRequest parameter and optionally 1 or more parameters that can be mapped from the url.

Hello World Example:

void helloFuncWorld(HttpRequest request) {
  request.response.write("Hello World! (from func handler)");

Vane server (server.dart)

With Vane you don't have to worry about writing a dart/web server, you focus on writing your controllers/handlers and Vane serves them for you automatically based on your @Route annotations.
All you need to do is to make sure they are in the same library and that you start the serve function.

Hello World with a Vane handler

import 'dart:async';
import 'package:vane/vane.dart';

class HelloWorld extends Vane {
  Future Hello() {
    return close("Hello world");

void main() => serve();

Example with all three types of handlers

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

class HelloVane extends Vane {
  Future World() {
    return close("Hello world! (from vane handler)");

  Future User(String user) {
    return close("Hello ${user}! (from vane handler)");

class HelloPodo {
  void World(HttpRequest request) {
    request.response.write("Hello World! (from podo handler)");

  void User(HttpRequest request, String user) {
    request.response.write("Hello World $user! (from podo handler)");

void helloFuncWorld(HttpRequest request) {
  request.response.write("Hello World! (from func handler)");

void helloFuncUser(HttpRequest request, String user) {
  request.response.write("Hello World $user! (from func handler)");

void main() => serve();

Documentation, examples and roadmap


  • Bugfix to handle empty requests with "Content-Type: application/json".


  • Added so render engine for server side template rendering is autodetected when not specified.


  • Revering back to single package structure.
  • New feature: server side rendering of templates .


  • First version as a seperate package, vane is being splitted up into multiple packages.
  • Change default port from 9090 to 8080 (breaking change).


  • Added a temporary fix for Windows that disables the client request proxy, currently blocked by issue #18 either way.


  • Added better error handling for when vane proxy can't reach an pub serve instance.
  • Merged pull request from @Gubaer fixing some typos in README.


  • Updated package versions
  • New proxy implementation


  • Changed behavior of 'return next(data)', before data was written to the response output, now we send the data on the Tube instead for processing in later stages of the middleware pipe.


  • Added first version of the new VaneModel implementation, documentation and tests


  • Changed behavior of logging by printing logging of proxied request to a different log level, since it can be seen in the output of pub serve anyways. It can be seen in the server output if the default logging level is changed like this:
void main() {
  serve(logLevel: Level.FINE);


  • Fix MongoDB related issue #5, before we assumed there always was a MONGODB_URI enviroment variable, not optimal. Now we instead give the user three options; if no enviroment variable is set, and no paramter is provided to serve(), then we use the standard mongodb://localhost:27017 uri. If there is an enviroment variable we will use that one, if the user want a different uri it is now also possible to override the default uri with a named optional paramter to serve().

Example using default mongodb://localhost:27017 uri: void main() => serve();

Example overriding with named paramter: void main() => serve(mongoUri: "mongodb://");


  • New proxy functionality to integrate Vane with pub serve for client requests. With Vane 0.6.0 cross origin requests are no longer needed.

To use the proxy you need to seperate your client and server code in a "client" and a "server" directory and have a simple dv.yaml file in the app root dir. Start by running "pub serve" in your client project's directory, let it use the standard 8080 port. Then start your Vane server seperatly from the Dart Editor by right clicking "server.dart" and pressing "Run". Last but not least, go to and you can use Vane and pub serve together!

To easily try out Vane 0.6.0, follow these instruction:

  • git clone
  • Open "Vane-Hello" in the Dart Editor
  • Wait for the Editor to run pub get (if it don't, run it yourself)
  • Right click server/server.dart and press "Run"
  • Right click client/index.html and press "Run in Dartium"
  • First try , just to see that it is only the client-side that works
  • Now try instead and see that both server-side and client-side will work!


  • Typo fixes by Victor Berchet
  • Fixed github issue #6
  • Added better logging, now possible to see when how Vane parses handlers and how it matches the correct handler.

See parsing of handlers (only on startup)

void main() {
  serve(logLevel: Level.FINE);

See parsing of handlers (only on startup) and matching of requests (on each request)

void main() {
  serve(logLevel: Level.FINER);


  • Added statusCode setter


  • Updated text and fixed errors in README
  • Added usage examples for Tube
  • Updated examples


  • New Vane server implementation that can serve three types of handlers based on the @Route annotation. The Vane server automatically scan your dart controller/handlers and serves them based on the @Route annotation.
  • New @Route annotation that can be used for Vane, Podo and Func handlers. The @Route annotation uses Url template syntax and Vane now supports mapping paramters from the Url as input paramters to handlers.
  • New middleware declaration syntax:

Example of before to add one middleware that runs before the main controller and one that runs after it:

class TestClass extends Vane {
  void init() {
    pre.add(new SyncExample());
    post.add(new SyncExample());

Example of new syntax:

class TestClass extends Vane {
  var pipeline = [SyncExample, This, SyncExample];
  • Middleware system can now sense when a middleware runs next() and if it is last in the pipeline, it will convert the next() call to a close() call so that the request can't hang itself. A controller can also get runtime information on where in the pipeline it is and how many controllers have/will run before and after with the new paramters pFirst, pLast and pIndex.


  • Updated Hello World example in README.


  • Added support so that the user can choose a different handler function than main, main is still default but a different handler can be choosed, hence the same object can be registred on multiple different paths, now it's for example possible to map all GET request to one method and all POST request to a different one. Before you had to have two seperate classes.
  • Added new shorthand for pathSegments called path. Similar to query, json, params and etc. Using pathSegments seems common enough and the default way to get it is complex enough compared to other parts of vane to be worth a shorthand.



  • Added some simple middleware classes. One that logs all request to the console (press "console" in dashboard of DartVoid to see it) and one that enables cross origin requests to your handler. If you enable the Cross middleware during development you can for example run the client code locally and have the server code run on DartVoid (we did this during the development of DartVoid's dashboard, it is written with Vane and has been developed on the platform it self...).


  • Added "the tube", a new way to communicate between middleware handlers. See docs for examples.


  • Syntax fix in docs.


  • Initial release.

Use this package as a library

1. Depend on it

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

  vane: ^0.8.2+1

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:vane/vane_server.dart';
Version Uploaded Documentation Archive
0.8.2+1 Feb 11, 2017 Go to the documentation of vane 0.8.2+1 Download vane 0.8.2+1 archive
0.8.2 Dec 11, 2016 Go to the documentation of vane 0.8.2 Download vane 0.8.2 archive
0.8.1 May 11, 2016 Go to the documentation of vane 0.8.1 Download vane 0.8.1 archive
0.8.0 Dec 4, 2015 Go to the documentation of vane 0.8.0 Download vane 0.8.0 archive
0.6.5+3 Jan 20, 2015 Go to the documentation of vane 0.6.5+3 Download vane 0.6.5+3 archive
0.6.5+2 Oct 20, 2014 Go to the documentation of vane 0.6.5+2 Download vane 0.6.5+2 archive
0.6.5+1 Oct 20, 2014 Go to the documentation of vane 0.6.5+1 Download vane 0.6.5+1 archive
0.6.5 Oct 18, 2014 Go to the documentation of vane 0.6.5 Download vane 0.6.5 archive
0.6.4 Aug 30, 2014 Go to the documentation of vane 0.6.4 Download vane 0.6.4 archive
0.6.2+1 Aug 6, 2014 Go to the documentation of vane 0.6.2+1 Download vane 0.6.2+1 archive

All 29 versions...

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

Maintenance issues and suggestions

Running dartdoc failed. (-10 points)

Make sure dartdoc runs without any issues.


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