createM4eUser method
Creates an M4eUser
and returns created M4eUniqueId
Throws AuthException
with NO_AUTH_USER
error
code if no user is authenticated
Throws ServerException
if call to server fails
Throws ServerException
with NO_INTERNET_CONNECTION
error
code device is not connected to the internet
Implementation
Future<M4eUniqueId> createM4eUser(M4eUserForm userForm) async {
if ((await _connectionChecker.hasConnection) ?? false) {
try {
final _token = await _authApi.getAuthTokenFromCache();
final _m4eUserId = await _userApi.createM4eUser(_token.id, userForm);
return _m4eUserId;
} catch (e) {
rethrow;
}
}
throw M4eExceptionMessages.kNoInternetConnectionException;
}