FLUTTER ECOSYSTEM

path_to_regexp

Converts a path such as '/user/:id' into a regular expression.

Latest version
0.4.0
30-day downloads
59.7K
Likes
46
Pub points
160

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

Overview

A Dart package that converts path patterns like '/user/:id' into regular expressions for route matching. It enables dynamic path parsing by supporting parameter capture, wildcards, and optional segments. Ideal for building routing systems in Flutter apps, it provides a lightweight solution for matching URLs against defined routes. The package is compatible across all major platforms and integrates seamlessly with existing navigation logic.

Use cases
  • Dynamic route matching
  • URL pattern parsing
  • Navigation system implementation
  • Route parameter extraction
  • Custom router development
  • API endpoint matching
Key features
  • Supports named parameters (e.g., :id)
  • Handles optional segments
  • Includes wildcard matching
  • Generates reusable RegExp objects
  • Lightweight and fast
  • Cross-platform compatibility
Suitable for
  • Developers building custom routers
  • Apps needing flexible URL routing
  • Frontend navigation with dynamic paths
  • Parsing complex route patterns
  • Integrating with existing routing libraries
Considerations
  • Does not handle query parameters
  • No built-in middleware support
  • Requires manual route resolution
  • Limited to path-level matching
  • Not designed for full HTTP server use
Supported platformsAndroidiOSWebmacOSWindowsLinux

Install package

flutter pub add path_to_regexp

Categories

Source repository

Related projects