error property
String
get
error
Returns the error message.
- Throws StateError if this result is a success
- Use isSuccess or isError to check the state before accessing
Implementation
String get error {
if (isSuccess) {
throw StateError('Cannot access error when result is a success.');
}
return _error!;
}