oxidized
6.2.0, released 2 years ago by an unverified publisher
Rust‑like Option and Result types for safer Dart code.
What it does
Provides sealed Option and Result classes that model nullable values and error handling similar to Rust. Includes functional helpers like match, when, and async redirection utilities.
AI-written summary of version 6.2.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want explicit handling of nulls and errors without using exceptions
- You need exhaustive pattern‑matching with sealed classes
- You prefer functional‑style APIs for error propagation
Skip it when
- Simple try/catch is sufficient and you don't need extra types
- You are looking for code‑generation or serialization helpers
- You need a full functional programming library rather than just Option/Result
Strengths
- Sealed classes enable exhaustive pattern matching
- Rich API with sync and async helpers
- Encourages safer, null‑free code
Weaknesses
- Adds extra abstraction and boilerplate
- Limited to Option/Result; no broader FP utilities
- May increase learning curve for developers unfamiliar with Rust concepts
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
import 'package:oxidized/oxidized.dart';
Result<String, Exception> readFileSync(String name) {
return Result.of(() => File(name).readAsStringSync());
}
void main() {
var result = readFileSync('README.md');
result.match((text) => print(text.substring(0, 80)), (err) => print(err));
}Alternatives
Packages that do the same job and could replace oxidized.
- result_type
A Result type representing success or failure in Dart
50Compare - result_dart
Kotlin and Swift inspired Result class for error handling in Dart and Flutter.
69Compare - option_result
Rust-like Option and Result types for Dart with exhaustive pattern matching support.
46Compare - rust_core
A pure Dart implementation of Rust patterns like Result, Option, Cell, Slice, and Array.
44Compare
Works with
Packages commonly used together with oxidized: ones it builds on, ones built on it, and its own family.