getWalletsWithUserId method

Future<List<M4eWallet>> getWalletsWithUserId (UniqueId userId)

Returns m4e user Wallets with specified user-id from m4e when connected to the internet or local cache (if exist) on no-internet-connectivity

Throws M4eAuthException if no m4e user is authenticated

Throws M4eCacheException if no Wallets are returned from cache on no-internet connectivity

Throws M4eServerException if request fails. This could be as a result of a Request timeout, Socket Exception or General server error

Pass-in an m4e user-id to fetch his wallets

Implementation

Future<List<M4eWallet>> getWalletsWithUserId(UniqueId userId) async {
  if ((await _connectionChecker.hasConnection) ?? false) {
    try {
      final _wallets = await _walletApi.fetchWalletsWithUserId(userId);

      return _wallets;
    } catch (e) {
      rethrow;
    }
  }

  throw M4eExceptionMessages.kNoInternetConnectionException;
}