add null check [skip ci]
Serhii committed
Dec 6, 2022 at 17:14 UTC
f29f17476c0faf16dfc169067841c9b937511d66
1 file changed
+5
-8
lib/exchange/sideshift/sideshift_exchange_provider.dart
+5
-8
@@ -249,15 +249,12 @@ class SideShiftExchangeProvider extends ExchangeProvider {
249
final expectedSendAmount = responseJSON['depositAmount'].toString();
250
final deposits = responseJSON['deposits'] as List?;
251
TradeState? state;
252
-
253
- if (deposits != null) {
254
- if (deposits.isEmpty) {
255
- state = TradeState.deserialize(raw: 'created');
256
- } else {
257
- final status = deposits[0]['status'] as String;
258
- state = TradeState.deserialize(raw: status);
259
- }
252
+ String? status;
253
+
254
+ if (deposits?.isNotEmpty ?? false) {
255
+ status = deposits![0]['status'] as String;
256
}
257
+ state = TradeState.deserialize(raw: status ?? 'created');
258
259
final expiredAtRaw = responseJSON['expiresAtISO'] as String;
260
final expiredAt =