mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-11-01 18:07:44 +00:00
28 lines
No EOL
638 B
Dart
28 lines
No EOL
638 B
Dart
import 'package:mobx/mobx.dart';
|
|
import 'package:cake_wallet/src/domain/common/transaction_info.dart';
|
|
|
|
abstract class TransactionHistoryBase<TransactionType extends TransactionInfo> {
|
|
TransactionHistoryBase() : _isUpdating = false;
|
|
|
|
@observable
|
|
ObservableList<TransactionType> transactions;
|
|
|
|
bool _isUpdating;
|
|
|
|
Future<void> update() async {
|
|
if (_isUpdating) {
|
|
return;
|
|
}
|
|
|
|
try {
|
|
_isUpdating = false;
|
|
transactions.addAll(await fetchTransactions());
|
|
_isUpdating = true;
|
|
} catch (e) {
|
|
_isUpdating = false;
|
|
rethrow;
|
|
}
|
|
}
|
|
|
|
Future<List<TransactionType>> fetchTransactions();
|
|
} |