Exception has occurred. DataException (errorBadRequest)
Zohalmohal opened this issue · 1 comments
Zohalmohal commented
Hello!
I tried to run your code but it gives me the following error:
Exception has occurred.
DataException (errorBadRequest)
The error occurs in this part of the code:
final favoritePairProvider = FutureProvider<FavoritePair>((ref) async {
final cancelToken = CancelToken();
ref.onDispose(() => cancelToken.cancel());
final settings = ref.watch(cryptoSettings);
String exchangeName = settings.maybeWhen(
data: (details) => details.favoriteExchange, orElse: () => "");
String pairName = settings.maybeWhen(
data: (details) => details.favoritePair, orElse: () => "");
if (exchangeName.isEmpty || pairName.isEmpty) {
throw DataException(message: LocaleKeys.errorSomethingWentWrong);
}
Pair pair = Pair(pair: pairName, exchange: exchangeName);
try {
PairSummary pairSummary = await ref
.read(cryptoRepository)
.getPairSummary(exchangeName, pairName, cancelToken: cancelToken);
return FavoritePair(pair: pair, pairSummary: pairSummary);
} on DataException catch (error) {
if (error.message == LocaleKeys.errorRequestNotFound) {
ref.read(cryptoSettings.notifier).verifyFavoritePair();
}
throw error;
}
});
I also changed the .env-example
file to .env
and copied my gotten API private key like below into it:
API_KEY=ddTaK3jVw5fgdfgdgfdgfgfdgfdgfd
Do you know how can I fix it?
tehsunnliu commented
You have to use the public key.