getUserWallets method

Future<List<Wallet>> getUserWallets (UniqueId userId)

Returns current m4e authenticated user Wallets 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

Implementation

Future<List<Wallet>> getUserWallets(UniqueId userId) async {
  if ((await _connectionChecker.hasConnection) ?? false) {
    try {
      final _wallets = await _walletApi.fetchUserWallets(userId);

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

  throw ExceptionMessages.kNoInternetConnectionException;
}