bliss 0.3.1

  • Example
  • Installing
  • Versions
  • 47


An easy to learn server side framework for Dart.


The purpose of this package is to be used internally at Indecks, but to also be extendable enough to be used in other projects. It can be used for serving static files and/or handling dynamic requests.


A simple use case example:

import 'package:bliss/bliss.dart';

main() {
  new Server()
    ..setStaticHandler('web', defaults: ['index.html'])
    ..addHandler('GET', '/api/user/:id', (Map data) {
      Map user = {};
      // query database with `data['id']` and assign it to `user`
      return user;
    ..addHandler('POST', '/api/post', (Map postData, HttpRequest request) async {
      // store `postData` into database
      // add cookie to `request`

Planned Features

  • [x] SSL support
  • [ ] Define specific codec for request payloads
  • [ ] WebSocket handlers

Features and bugs

Please file feature requests and bugs at the issue tracker.


Feel free to fork and make a pull request. Please stick to the Dart Style Guide



  • Strong mode compliant.


  • Support for hyphens in handler paths.
  • Can add custom headers to static handler.


  • Fixed server crash when accept-encoding header is not present on incoming HttpRequest.


  • The static handler now supports three more optional parameters;
    • cacheController: A function to determine the maximum duration for the browser to cache a static resource.
    • errorResponses: A map specifying what static resources to repond with when the server responds with a error code.
    • spaDefault: Added for the purpose of serving single page applications. If the server cannot find a resource and spaDefault is defined, it will respond with the spaDefault file instead and let the client handle the routing.


  • SSL support, setting the securityContext property will automatically bindSecure() on start().


  • Fixed Issue #1, can now leave Server constructor's parameters empty.


  • Create new Server object to set static handler and add dynamic handlers.


  • Initial version, created by Stagehand


library bliss.example;

import 'dart:async';

import 'package:bliss/bliss.dart';

void main() {
  new Server()
    ..setStaticHandler('web', cacheController: defaultCacheController)
    ..addHandler('get', '/api/:example', returnData)

    // Run the server to start listening for requests.

// You can use asynchronous function for the handler task's and it will await
// for the response.
Future returnData(data) async => data;

Use this package as a library

1. Depend on it

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

  bliss: "^0.3.1"

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter packages get

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

3. Import it

Now in your Dart code, you can use:

      import 'package:bliss/bliss.dart';
Version Uploaded Documentation Archive
0.3.1 Dec 14, 2017 Go to the documentation of bliss 0.3.1 Download bliss 0.3.1 archive
0.3.0 Nov 13, 2016 Go to the documentation of bliss 0.3.0 Download bliss 0.3.0 archive
0.2.1 Jul 16, 2016 Go to the documentation of bliss 0.2.1 Download bliss 0.2.1 archive
0.2.0 May 28, 2016 Go to the documentation of bliss 0.2.0 Download bliss 0.2.0 archive
0.1.5 Feb 27, 2016 Go to the documentation of bliss 0.1.5 Download bliss 0.1.5 archive
0.1.2 Jan 26, 2016 Go to the documentation of bliss 0.1.2 Download bliss 0.1.2 archive
0.1.1 Jan 23, 2016 Go to the documentation of bliss 0.1.1 Download bliss 0.1.1 archive
0.1.0 Jan 23, 2016 Go to the documentation of bliss 0.1.0 Download bliss 0.1.0 archive


We analyzed this package on Jun 12, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.60.0
  • pana: 0.11.3


Describes how popular the package is relative to other packages. [more]
0 / 100
Code health derived from static analysis. [more]
91 / 100
Reflects how tidy and up-to-date the package is. [more]
99 / 100
Overall score:
Weighted score of the above. [more]
Learn more about scoring.


Detected platforms: Flutter, other

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


  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 1 error 9 hints.

    Strong-mode analysis of lib/src/server/_static_handler.dart failed with the following error:

    line: 220 col: 11
    The function expression type '(String) → bool' isn't of type '(dynamic) → bool'. This means its parameter or return type does not match what is expected. Consider changing parameter type(s) or the returned type(s).

    Run dartfmt to format lib/bliss.dart.

    Similar analysis of the following files failed:

    • lib/src/server/_handler.dart (hint)
    • lib/src/server/server.dart (hint)
  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.8.0 <2.0.0
mime >=0.9.3 <0.10.0 0.9.6+1
path ^1.0.0 1.6.0
Dev dependencies
test >=0.12.0 <0.13.0