Skip to content
pubscout

functional_status_codes

3.2.0, released 8 months ago by tsin.is

Zero-cost HTTP status codes as int extension types with functional helpers.

WASM-ready
$ flutter pub add functional_status_codes
Source repository

What it does

Provides type-safe HTTP status codes using Dart extension types for zero-cost abstraction over integers. Includes semantic helpers, range checks, pre-sorted category collections, random generation, and functional methods like when and map.

AI-written summary of version 3.2.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You want type-safe and readable HTTP status code checks in your Dart or Flutter project.
  • You need functional helpers and pattern matching over status codes without runtime overhead.

Skip it when

  • You only require a minimal set of standard integer constants and do not want any additional extension methods.

Strengths

  • Zero-cost abstraction built on Dart 3.3 extension types.
  • Comprehensive coverage of IANA registered status codes and unofficial codes.
  • No third-party dependencies.
  • Rich set of semantic helpers like isCacheable and isRetryable.

Weaknesses

  • Requires Dart 3.3 or higher.
  • Niche utility package focused solely on status codes.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0

Add the package to pubspec.yaml and import it where needed.

print(200.isSuccess); // Prints true.
print(429.isRetryable); // Prints true.

Alternatives

Packages that do the same job and could replace functional_status_codes.

  • http

    Provides general HTTP client functionality which includes basic status code handling constants if you do not need advanced functional status code features.