logoutUser method
- {int requestCount = 2}
Logout the currently logged in user.
requestCount
can be used to determine the number of repeated requests before a failure is returned if the call is not successful.
Returns a AnybillResult.success that confirms the logout.
Throws a AnybillResult.failure with the specified information gained from the API. This could be a DioException when a generic errors occurred or a different Exception for critical errors that couldn't be caught.
Implementation
Future<AnybillResult<void>> logoutUser({
int requestCount = 2,
}) async {
AnybillLogger.info("Tried to logout user");
try {
await _tokenProvider.deleteAuthInformation();
return AnybillResult.success(
HttpStatus.noContent,
);
}
// ----------------------------------------------------------------
catch (error, stacktrace) {
return ErrorHandler.handleError(
error,
stacktrace,
requestCount: requestCount,
request: () => logoutUser(),
event: "logoutUser",
library: runtimeType.toString(),
);
}
}