getWalletsWithUserId method

Future<List<Wallet>> 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 AuthException if no m4e user is authenticated

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

Throws ServerException 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<Wallet>> getWalletsWithUserId(UniqueId userId) async {
  if ((await _connectionChecker.hasConnection) ?? false) {
    try {
      final _wallets = await _walletApi.fetchWalletsWithUserId(userId);

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

  throw ExceptionMessages.kNoInternetConnectionException;
}