Option<A, B> class final

An expressive way to handle null checks

If you want to get the value, please use dart's cascade operator

(await pollDelegator()) // pollDelegator returns Future<Option<...,String>>
  ..onBad((reason) => print(reason))
  ..onGood((value) => sendToDataBase(value));

i love this very much (brings back the good old memories of java verbosity!)

Constructors

Option.fuckedUp({required B reason})
oops! the data is gone!?!?
const
Option.good({A? value, required B reason})
const

Properties

hashCode int
The hash code for this object.
no setterinherited
isBad bool
no setter
reason → B
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onBad(void fx(B reason)) → void
onGood(void fx(A value)) → void
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited