Humanizer

pub package

All Contributors

Humanizer is currently in preview. APIs are not yet finalized. We welcome feedback and suggestions as we work towards a stable release.

What?

A Dart library to convert values into human-friendly representations.

Why?

When writing user interfaces we often want to present data we have in a raw format in a way that makes sense to the end user, but doing so is often non-trivial. This library aims to make such conversions easy and flexible.

Where?

Firstly, install the humanizer package, then you can import Humanizer into your Dart code as follows:

import 'package:humanizer/humanizer.dart';

How?

This library has a broad API surface, and in fact has multiple API layers as discussed here. The following table gives a high level overview of the various features, with links to deeper discussion:

FeatureDescription
SymbolsTransform programming symbol names into human-friendly representations.
String casingTransforms input strings to Sentence case or Title Case.
String truncationIntelligently truncates input strings.
Approximate relative timeDescribes a DateTime relative to "now" in a human-friendly manner.
PluralityAlters the plurality of an input word.
Ordinal numbersConverts an integral value to ordinal form (1st / first, 2nd / second etc).
Cardinal numbersConverts an integral value to cardinal form (one, two, three etc).
Units of measurementProvides types to represent common units of measurement and the ability to convert those types to a human-readable form.

Note that whilst this library is locale-aware, it currently only includes an English implementation.

Who?

Thanks goes to these wonderful people (emoji key):


Kent Boogaart

💻 ⚠️ 📖 💡

This project follows the all-contributors specification. Contributions of any kind welcome!

Special thanks to these inspirational open source libraries:

Libraries

humanizer
A Dart library to convert values into human-friendly Strings.