slugify
2.0.0, released 6 years ago by an unverified publisher
Converts a string into a URL‑friendly slug with configurable delimiter and case options.
What it does
The package provides a top‑level `slugify` function that transforms any input string into a slug by removing unfriendly characters and optionally lower‑casing the result. You can customize the delimiter and case sensitivity via parameters.
AI-written summary of version 2.0.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to generate URL‑safe identifiers from user‑provided text
- You want a lightweight, null‑safe solution without external dependencies
Skip it when
- You require full transliteration for many languages beyond the provided approximations
- You need a slug generator that integrates with a specific framework’s routing system
Strengths
- Zero dependencies and null‑safe
- Simple API with sensible defaults
- Supports custom delimiter and case options
Weaknesses
- Limited language coverage compared to full transliteration libraries
- No streaming or batch processing support
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
import 'package:slugify/slugify.dart';
void main(){
var slug = slugify('Hello, World! Foo Bar');
print(slug); // hello-world-foo-bar
var slug2 = slugify('Hello, World! Foo Bar', lowercase:false, delimiter:'🙂');
print(slug2); // Hello🙂World🙂Foo🙂Bar
}Alternatives
Packages that do the same job and could replace slugify.
- validators2
String validation and sanitization for Dart.
83Compare - fraction
Create, parse, and perform arithmetic operations with fractions and mixed fractions.
84Compare - string_to_color
Convert strings to colors, hex strings, or hex integers in Dart and Flutter.
42Compare - qs_dart
A query string encoding and decoding library for Dart ported from JavaScript's qs.
77Compare
Works with
Packages commonly used together with slugify: ones it builds on, ones built on it, and its own family.