cake_wallet/lib/core/transaction_history.dart

27 lines
528 B
Dart
Raw Normal View History

2020-06-01 18:13:56 +00:00
import 'package:mobx/mobx.dart';
abstract class TranasctionHistoryBase<TransactionType> {
TranasctionHistoryBase() : _isUpdating = false;
@observable
List<TransactionType> transactions;
bool _isUpdating;
Future<void> update() async {
if (_isUpdating) {
return;
}
try {
_isUpdating = false;
transactions = await fetchTransactions();
_isUpdating = true;
} catch (e) {
_isUpdating = false;
rethrow;
}
}
Future<List<TransactionType>> fetchTransactions();
}