fluri library

A fluent URI mutation library.

Importing

Once installed, import the fluri package:

import 'package:fluri/fluri.dart';

Usage

The fluri library can be used in two different ways. You can use the Fluri class directly as a replacement for Uri, or you can extend or mix in FluriMixin to add the fluent mutation API to your own class.

Using Fluri Directly

import 'package:fluri/fluri.dart';

void main() {
  Fluri fluri = new Fluri()
    ..host = 'example.com'
    ..scheme = 'https'
    ..path = 'path/to/resource'
    ..queryParameters = {'limit': '10', 'format': 'json'};

  print(fluri.toString());
  // https://example.com/path/to/resource?limit=10&format=json
}

Extending/Mixing FluriMixin

import 'package:fluri/fluri.dart';

// Option 1: Extending
class Request extends FluriMixin {}

// Option 2: Using as a Mixin
class Request extends Object with FluriMixin {}

void main() {
  Request req = new Request()
    ..host = 'example.com'
    ..scheme = 'https'
    ..path = 'path/to/resource'
    ..queryParameters = {'limit': '10', 'format': 'json'};

  print(req.uri.toString());
  // https://example.com/path/to/resource?limit=10&format=json
}

Classes

Fluri
A fluent URI mutation API built on top of Uri. [...]
FluriMixin
A fluent URI mutation API built on top of Uri that can be easily extended or mixed in. [...]