Skip to content
Dart package to convert a string to a slug, useful for URLs and more
Dart
Branch: master
Clone or download
Latest commit fa460d3 Apr 24, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
example Add print examples Apr 24, 2019
lib Add replacement for ampersand Apr 24, 2019
test Add replacement for ampersand Apr 24, 2019
.gitignore Upgrade to Dart 2 Apr 23, 2019
CHANGELOG.md Update CHANGELOG Apr 24, 2019
LICENSE Update LICENSE Jul 29, 2014
README.md Update README Apr 24, 2019
pubspec.lock Upgrade to Dart 2 Apr 23, 2019
pubspec.yaml Update email Apr 24, 2019

README.md

Slugify

Dart package to convert a string to a slug, useful for URLs, filenames, IDs and more.

Features

  • Removes unfavorable characters
  • Approximates replacements for characters not in the Latin alphabet
  • Options for a custom delimiter and case sensitivity
  • Supports Dart 2

Usage

import 'package:slugify/slugify.dart';

// Use with default options.
String slug = Slugify('Hello, World! Foo Bar');
print(slug); // hello-world-foo-bar

// Use with custom options.
String slug2 = Slugify('Hello, World! Foo Bar', lowercase: false, delimiter: '🙂');
print(slug2) // Hello🙂World🙂Foo🙂Bar

Options

Name Type Default Description
delimiter String "-" Separator between words
lowercase bool true Convert text to lowercase
You can’t perform that action at this time.