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