Skip to content
pubscout

http_status_code

0.0.2, released 5 years ago by an unverified publisher

A Dart library providing constants and helpers for HTTP status codes.

WASM-ready
$ flutter pub add http_status_code
Source repository

What it does

It defines an enum of all standard HTTP status codes and offers a function to get the human‑readable message for a code. The library is used to compare response status codes in a type‑safe way.

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

Use it when

  • You need to check HTTP responses against standard status codes.
  • You want a single source of truth for status code names and messages.
  • You prefer a lightweight, dependency‑free helper over writing your own constants.

Skip it when

  • You already use a networking library that exposes status code names (e.g., http or dio).
  • You need advanced HTTP client features beyond status code handling.

Strengths

  • Zero dependencies, small footprint.
  • Comprehensive coverage of RFC‑defined codes.
  • Type‑safe enum for status codes.

Weaknesses

  • No networking functionality; only status code helpers.
  • No support for custom or non‑standard codes.
  • Not maintained beyond initial release.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0
import 'package:http_status_code/http_status_code.dart';

if (response.statusCode == StatusCode.OK) {
  final message = getStatusMessage(response.statusCode);
}

Alternatives

Packages that do the same job and could replace http_status_code.

  • http

    Provides both networking and status code handling in one package.