FLUTTER ECOSYSTEM

either_dart

Error handler library for type-safe and easy work with errors on Dart and Flutter. Either is an alternative to Nullable value and Exceptions.

Latest version
1.0.0
30-day downloads
46.2K
Likes
158
Pub points
160

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

Overview

Either Dart is a type-safe error handling library that provides an alternative to nullable values and exceptions. It uses the `Either<L, R>` type to represent computations that can result in either a successful value (Right) or an error (Left), enabling explicit and composable error management. This approach improves code readability and reduces runtime errors by forcing developers to handle both success and failure cases. Ideal for functional programming patterns in Dart and Flutter applications.

Use cases
  • Handling API responses with success or error states
  • Replacing nullable returns with explicit outcomes
  • Managing asynchronous operations with error propagation
  • Implementing functional-style error handling
  • Avoiding try-catch blocks for control flow
Key features
  • Type-safe error handling with Either<L, R>
  • No need for exceptions or null checks
  • Composable error and success flows
  • Supports functional programming paradigms
  • Clean separation of success and failure paths
Suitable for
  • Developers preferring functional programming
  • Projects requiring robust error handling
  • Teams aiming to reduce runtime crashes
  • Flutter apps with complex state management
  • Applications needing clear error semantics
Considerations
  • Requires learning the Either pattern
  • May increase boilerplate for simple cases
  • Not suitable for traditional exception-based workflows
  • Limited ecosystem compared to standard exceptions
  • Best used in conjunction with other functional utilities
Supported platformsAndroidiOSWebmacOSWindowsLinux

Install package

flutter pub add either_dart

Categories

Related projects