Skip to content
pubscout

oxidized

6.2.0, released 2 years ago by an unverified publisher

Rust‑like Option and Result types for safer Dart code.

WASM-ready
$ flutter pub add oxidized
Source repository

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

  • result_dart

    Kotlin and Swift inspired Result class for error handling in Dart and Flutter.

  • option_result

    Rust-like Option and Result types for Dart with exhaustive pattern matching support.

  • rust_core

    A pure Dart implementation of Rust patterns like Result, Option, Cell, Slice, and Array.

Works with

Packages commonly used together with oxidized: ones it builds on, ones built on it, and its own family.