process method
Convenience function that simplifies working with MLoginCitResults.
Implementation
void process(
/// Called in case the request was successful
Function(String jwt) successHandler,
/// Called in case the request encountered an error
Function(MLoginCitError error) errorHandler,
) {
if (this is MLoginCitResultError) {
errorHandler((this as MLoginCitResultError).error);
} else if (this is MLoginCitResultSuccess) {
MLoginCitResultSuccess successResult = this as MLoginCitResultSuccess;
successHandler(successResult.jwt);
} else {
MLoginLog.error(
'ERROR! Unexpected result type $this. Fallback to unknown error.');
errorHandler(MLoginCitError.unknown);
}
}