charcode
1.4.0, released 2 years ago by infimum.dk
Provides named integer constants for ASCII and HTML character codes.
WASM-ready
What it does
The package defines symbolic names for character codes, making code that works with integer character values more readable. It also offers a CLI tool to generate a custom set of constants for a project.
AI-written summary of version 1.4.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need readable constants for ASCII or common HTML entities in Dart code.
- You want to avoid hard‑coding integer literals for characters.
- You prefer a small, dependency‑free helper for character code lookups.
- You plan to generate a custom file and keep the package as a dev dependency.
Skip it when
- You already have a code‑generation tool that produces constants.
- You need runtime access to a large set of Unicode characters beyond ASCII and HTML entities.
- You prefer to use string literals instead of integer codes.
Strengths
- Zero runtime dependency, pure Dart constants.
- Supports both ASCII and HTML entities with clear naming conventions.
- CLI generator lets you create a trimmed set of constants for production.
- No build_runner or code‑gen setup required for basic use.
Weaknesses
- Limited to ASCII and HTML 4.01 entities; no full Unicode support.
- Requires manual generation for custom sets if you want to drop unused constants.
- No integration with other code‑gen workflows.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
Add to pubspec, import package/ascii.dart or html_entity.dart, or run CLI to generate a file.
import "package:charcode/ascii.dart";
void main() {
if (firstChar == $A) {
print('Starts with A');
}
}Alternatives
Packages that do the same job and could replace charcode.
- http_status_code
A Dart library providing constants and helpers for HTTP status codes.
39Compare
Works with
Packages commonly used together with charcode: ones it builds on, ones built on it, and its own family.
- sqlparserBuilt on charcodeSQL parser and static analyzer for SQLite written in Dart.
- drift_devBuilt on charcodeGenerates Dart database code from Drift table definitions as a dev‑dependency.
- promptsBuilt on charcodeSynchronous command-line prompt library for Dart with pretty colors.
- postgresBuilt on charcodePostgreSQL driver for Dart supporting binary protocol, pooling and statement reuse.
- universal_htmlBuilt on charcodeCross‑platform replacement for dart:html with DOM parsing, XML support, and EventSource.
- flutter_quillBuilt on charcodeA rich text WYSIWYG editor component and toolbar for Flutter apps.
- zxing2Built on charcodePure Dart library for encoding and decoding QR codes.
- sassBuilt on charcodeA Dart implementation of Sass for compiling Sass and SCSS to CSS.