CResult<Value, Error> class sealed

Implementers

Constructors

CResult.err(Error error)
factory
CResult.from(dynamic value)
Constructs a CResult from a dynamic value If the value is CResult it will return the value itself If the value is Value it will return COk If the value is Error it will return CErr
factory
CResult.ok(Value value)
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
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
toString() String
A string representation of this object.
inherited

Operators

operator /(dynamic a) → Error
Returns the error if it is CErr or throws an error if it is COk Convinient operator to get the error from the result, user should ensure that the result is CErr, otherwise it will throw an UnimplementedError Usage: final res = CResult<int, String>.from('error'); final err = res / 0; assert(err == 'error');
operator ==(Object other) bool
The equality operator.
inherited
operator |(dynamic a) → Value
Returns the value if it is COk or throws an error if it is CErr Convinient operator to get the value from the result, user should ensure that the result is COk, otherwise it will throw an UnimplementedError Usage: final res = CResult<int, String>.from(1); final val = res | 0; assert(val == 1);
operator ~() → dynamic
Returns the inner Value from COk or Error from CErr Convinient operator to get the inner value from the CResult, Usage: