fpdart
1.2.0, released a year ago by sandromaglione.com
Functional programming types and patterns for Dart and Flutter.
What it does
Provides core functional programming types and patterns like Option, Either, IO, Task, Reader, State, and immutable collections. Fully documented and tested.
AI-written summary of version 1.2.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want to enforce strict error handling using Either instead of throwing exceptions.
- You want to handle missing values safely using the Option type.
- You prefer functional programming patterns in your Dart and Flutter applications.
Skip it when
- Your team is not familiar with functional programming concepts and prefers standard imperative Dart style.
- You only need simple async utilities already available in standard Dart libraries.
Strengths
- Comprehensive suite of functional types (Option, Either, Task, Reader, State, etc.).
- First-class support for Dart 3 features like sealed classes, pattern matching, and records.
- Extensive documentation and blog posts/tutorials by the author.
Weaknesses
- Steep learning curve for developers new to functional programming paradigms.
- Version 2 rewrite is currently in development and pre-release stage.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
Add fpdart to pubspec.yaml dependencies.
final option = Option.of(10);
final map = option.map((a) => '$a');
final value = option.getOrElse(() => -1);Alternatives
Packages that do the same job and could replace fpdart.
- dart_either
Either monad for Dart and Flutter supporting type-safe error handling and railway-oriented programming.
81Compare - baseflow_plugin_template
A template for plugin examples
53Compare - result_type
A Result type representing success or failure in Dart
50Compare - rust_core
A pure Dart implementation of Rust patterns like Result, Option, Cell, Slice, and Array.
44Compare
Works with
Packages commonly used together with fpdart: ones it builds on, ones built on it, and its own family.