menu
dart_patterns package
documentation
result.dart
Result<T> class
Result<T> class
dark_mode
light_mode
Result<
T
>
class
sealed
Implementers
Failure
Success
Constructors
Result.failure
([
Object
?
failure
,
StackTrace
?
stackTrace
])
Creates a
Failure
result.
const
factory
Result.success
(
T
value
)
Creates a
Success
result.
const
factory
Properties
hashCode
→
int
The hash code for this object.
no setter
inherited
runtimeType
→
Type
A representation of the runtime type of the object.
no setter
inherited
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 ==
(
Object
other
)
→
bool
The equality operator.
inherited
Static Methods
guard
<
T
>
(
T
f
()
)
→
Result
<
T
>
Wraps a function call in a try-catch block. Returns a
Success
result if the function call succeeds. Returns a
Failure
result if the function call throws.
dart_patterns package
documentation
result
Result<T> class
result library