Viewing version 1.1.1. Open the latest package page.

fluri

1.1.1

Fluri is a fluent URI library built to make URI mutation easy.

Download archive

Readme

fluri

Pub Build Status codecov.io documentation

Fluri is a fluent URI library for Dart built to make URI mutation easy.

The dart:core.Uri class provides an immutable representation of URIs, which makes it difficult to incrementally build them or update them at a later time. If you wanted to build a long URI from the individual pieces, you would do something like this:

Uri uri = new Uri(
  scheme: 'https',
  host: 'example.com',
  path: 'path/to/resource'
);

If you later wanted to update the path and add a query parameter, you'd have to do this:

uri = uri.replace(
  path: 'new/path',
  query: 'foo=true'
);

Now let's say you want update the query without losing what you already have:

Map query = new Map.from(uri.queryParameters);
query['bar'] = '10';
uri = uri.replace(queryParameters: query);

As you can see, incremental or fluent-style URI mutations become a hassle with the core Uri class.

With fluri, the above interactions are easy:

import 'package:fluri/fluri.dart';

Fluri fluri = new Fluri()
  ..scheme = 'https'
  ..host = 'example.com'
  ..path = 'path/to/resource';

fluri
  ..path = 'new/path'
  ..query = 'foo=true';

fluri.updateQuery({'bar': '10'});

Additional methods like appendToPath and setQueryParam make it easy to build on top of a base URL:

import 'package:fluri/fluri.dart';

Fluri base = new Fluri('https://example.com/base/');

Fluri fluri = new Fluri.from(base)
  ..appendToPath('path/to/resource')
  ..setQueryParam('count', '10');

Development

This project leverages the dart_dev package for most of its tooling needs, including static analysis, code formatting, running tests, collecting coverage, and serving examples. Check out the dart_dev readme for more information.

Changelog

Changelog

1.1.1

  • Bug Fix: FluriMixin now defaults to an empty URI when uri is set to null.

1.1.0

New Features:

  • appendToPath(path) - append a path literal to the current path.
  • addPathSegment(segment) - add a single path segment to the current path.
  • setQueryParam(param, value) - set a single query parameter.
  • Fluri.from(other) - construct a Fluri instance from another.
  • Fluri.fromUri(uri) - construct a Fluri instance from a Uri instance.

1.0.1

No source changes in this release.

  • Add code coverage reporting.
  • Minor fixes and improvements to the readme.
  • Code formatting improvements thanks to dartfmt.

1.0.0

  • Initial version of Fluri: a fluent URI library for Dart built to make URI mutation easy.

Installing

export PUB_HOSTED_URL=https://pub.mirror.p-hatan.ir
flutter pub add 'fluri:1.1.1'
pubspec.yaml
name: fluri
version: 1.1.1
description: Fluri is a fluent URI library built to make URI mutation easy.
authors:
  - Workiva Client Platform Team <clientplatform@workiva.com>
  - Dustin Lessard <evan.weible@workiva.com>
  - Evan Weible <evan.weible@workiva.com>
  - Jay Udey <jay.udey@workiva.com>
  - Max Peterson <maxwell.peterson@workiva.com>
  - Trent Grover <trent.grover@workiva.com>
homepage: https://github.com/Workiva/fluri
dev_dependencies:
  coverage: "^0.7.2"
  dart_dev: "^1.0.0"
  dart_style: "^0.2.0"
  dartdoc: "^0.8.0"
  test: "^0.12.0"
environment:
  sdk: ">=1.9.0 <2.0.0"

Version history

VersionPublishedArchiveSHA-256
1.0.0Cached · Upstream SHA-256 matchedDownload5d57ff7e…19002b
1.0.1Cached · Upstream SHA-256 matchedDownloadd075ff41…eed076
1.1.0Cached · Upstream SHA-256 matchedDownload617a5c6f…cfa2f8
1.1.1Cached · Upstream SHA-256 matchedDownload4a9f040b…90b9d1
1.2.0Cached · Upstream SHA-256 matchedDownload421fda9e…39348c
1.2.1Cached · Upstream SHA-256 matchedDownloadf9a987bd…0f1e8a
1.2.2Cached · Upstream SHA-256 matchedDownload1a0b4419…ff38e6
1.2.3Cached · Upstream SHA-256 matchedDownload1145c603…e882c2
1.2.4Cached · Upstream SHA-256 matchedDownload0492d70b…30b0a3
1.2.5Cached · Upstream SHA-256 matchedDownload0e7c5b47…9f17be
1.2.6Cached · Upstream SHA-256 matchedDownload3f6230a0…58951d
1.2.7Cached · Upstream SHA-256 matchedDownload8a0326fc…25f8a8
1.2.8Cached · Upstream SHA-256 matchedDownloada9c90b44…f99923
1.3.0Cached · Upstream SHA-256 matchedDownload3dade143…fe94b3
2.0.0Cached · Upstream SHA-256 matchedDownload0a4d784e…88540a
2.0.1Cached · Upstream SHA-256 matchedDownload895884da…f0febc
2.0.2Cached · Upstream SHA-256 matchedDownloade58c9bf5…9f828f
2.0.3Cached · Upstream SHA-256 matchedDownload16593549…614dc8
2.0.4Cached · Upstream SHA-256 matchedDownload0715ffdf…1cc48f
2.0.5Cached · Upstream SHA-256 matchedDownloada6151890…2cdd1e
2.0.6Cached · Upstream SHA-256 matchedDownload186cd173…638a80

Dependencies

No direct dependencies declared.