What changed, and why it matters
This commit swaps the app's local database library from the original 'hive' package to a community-maintained fork called 'hive_ce' (Community Edition). Most changes are mechanical import renames and formatting. There is no direct evidence in the commit that this fixes a specific security vulnerability, but replacing an unmaintained dependency with a maintained fork can reduce long-term security risk. The commit does not describe any security issue or credit a researcher.
Treat as a routine maintenance/dependency migration. Review the hive_ce fork's changelog and security posture before relying on it in production. Run the full test suite and verify that encrypted Hive boxes and desktop password service still behave correctly, since the migration touches storage internals.
Security signals we found
Dependency migration from unmaintained 'hive' to community fork 'hive_ce'
No explicit security fix or vulnerability description in commit message
No changes to encryption, authentication, or input-validation logic observed
Large generated mock diff obscures meaningful security-relevant changes
Evidence from the diff
The diff migrates all Dart imports from ‘package:hive/hive.dart’ and ‘package:hive/src/hive_impl.dart’ to ‘package:hive_ce/hive.dart’ and ‘package:hive_ce/src/hive_impl.dart’. pubspec.yaml/template and pubspec.lock are updated to depend on hive_ce 2.13.2, hive_ce_flutter 2.3.2, and hive_ce_generator 1.9.3, while the original hive becomes a transitive dependency. The remaining changes are regenerated mock files and formatting-only adjustments in tests and model files. No functional code logic changes are visible.
Changed components
lib/db/hive/db.dartlib/db/special_migrations.dartlib/models/* (Hive type adapters)lib/utilities/desktop_password_service.dartpubspec.yaml template and pubspec.locktest/* (mock files using Hive BinaryReader/BinaryWriter)Inspect captured patch +856 / −1244
diff --git a/lib/db/hive/db.dart b/lib/db/hive/db.dart
index be431ab..3eac4b8 100644
--- a/lib/db/hive/db.dart
+++ b/lib/db/hive/db.dart
@@ -11,8 +11,8 @@
import 'dart:isolate';
import 'package:compat/compat.dart' as lib_monero_compat;
-import 'package:hive/hive.dart' show Box;
-import 'package:hive/src/hive_impl.dart';
+import 'package:hive_ce/src/hive_impl.dart';
+import 'package:hive_ce/hive.dart' show Box;
import 'package:mutex/mutex.dart';
import '../../app_config.dart';
diff --git a/lib/db/special_migrations.dart b/lib/db/special_migrations.dart
index 1092cfc..84b1751 100644
--- a/lib/db/special_migrations.dart
+++ b/lib/db/special_migrations.dart
@@ -1,8 +1,8 @@
import 'dart:io';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
-import 'package:hive/hive.dart' show Box;
-import 'package:hive/src/hive_impl.dart';
+import 'package:hive_ce/hive.dart' show Box;
+import 'package:hive_ce/src/hive_impl.dart';
import 'package:path_provider/path_provider.dart';
import '../app_config.dart';
@@ -13,10 +13,8 @@ abstract class CampfireMigration {
static const _didRunKey = "campfire_one_time_migration_done_key";
static bool get didRun =>
- DB.instance.get<dynamic>(
- boxName: DB.boxNameDBInfo,
- key: _didRunKey,
- ) as bool? ??
+ DB.instance.get<dynamic>(boxName: DB.boxNameDBInfo, key: _didRunKey)
+ as bool? ??
false;
static Future<void> setDidRun() async {
diff --git a/lib/models/epicbox_config_model.dart b/lib/models/epicbox_config_model.dart
index 4d22dad..71fe822 100644
--- a/lib/models/epicbox_config_model.dart
+++ b/lib/models/epicbox_config_model.dart
@@ -10,7 +10,7 @@
import 'dart:convert';
-import 'package:hive/hive.dart';
+import 'package:hive_ce/hive.dart';
import 'epicbox_server_model.dart';
diff --git a/lib/models/epicbox_server_model.dart b/lib/models/epicbox_server_model.dart
index 8101689..c0d5816 100644
--- a/lib/models/epicbox_server_model.dart
+++ b/lib/models/epicbox_server_model.dart
@@ -8,7 +8,7 @@
*
*/
-import 'package:hive/hive.dart';
+import 'package:hive_ce/hive.dart';
part 'type_adaptors/epicbox_server_model.g.dart';
diff --git a/lib/models/exchange/change_now/exchange_transaction.dart b/lib/models/exchange/change_now/exchange_transaction.dart
index 1de49bf..b5b43dd 100644
--- a/lib/models/exchange/change_now/exchange_transaction.dart
+++ b/lib/models/exchange/change_now/exchange_transaction.dart
@@ -9,7 +9,7 @@
*/
import 'package:decimal/decimal.dart';
-import 'package:hive/hive.dart';
+import 'package:hive_ce/hive.dart';
import 'package:uuid/uuid.dart';
import 'exchange_transaction_status.dart';
@@ -117,12 +117,11 @@ class ExchangeTransaction {
DateTime.tryParse(json["date"] as String? ?? "") ??
DateTime.fromMillisecondsSinceEpoch(0),
statusString: json["statusString"] as String? ?? "",
- statusObject:
- json["statusObject"] is Map<String, dynamic>
- ? ExchangeTransactionStatus.fromJson(
- json["statusObject"] as Map<String, dynamic>,
- )
- : null,
+ statusObject: json["statusObject"] is Map<String, dynamic>
+ ? ExchangeTransactionStatus.fromJson(
+ json["statusObject"] as Map<String, dynamic>,
+ )
+ : null,
);
} catch (e) {
rethrow;
diff --git a/lib/models/exchange/change_now/exchange_transaction_status.dart b/lib/models/exchange/change_now/exchange_transaction_status.dart
index 5a90469..def02d5 100644
--- a/lib/models/exchange/change_now/exchange_transaction_status.dart
+++ b/lib/models/exchange/change_now/exchange_transaction_status.dart
@@ -8,7 +8,7 @@
*
*/
-import 'package:hive/hive.dart';
+import 'package:hive_ce/hive.dart';
import '../../../utilities/logger.dart';
import 'cn_exchange_transaction_status.dart'
@@ -177,14 +177,12 @@ class ExchangeTransactionStatus {
toCurrency: json["toCurrency"] as String? ?? "",
id: json["id"] as String,
updatedAt: json["updatedAt"] as String? ?? "",
- expectedSendAmountDecimal:
- json["expectedSendAmount"] == null
- ? ""
- : json["expectedSendAmount"].toString(),
- expectedReceiveAmountDecimal:
- json["expectedReceiveAmount"] == null
- ? ""
- : json["expectedReceiveAmount"].toString(),
+ expectedSendAmountDecimal: json["expectedSendAmount"] == null
+ ? ""
+ : json["expectedSendAmount"].toString(),
+ expectedReceiveAmountDecimal: json["expectedReceiveAmount"] == null
+ ? ""
+ : json["expectedReceiveAmount"].toString(),
createdAt: json["createdAt"] as String? ?? "",
isPartner: json["isPartner"] as bool,
depositReceivedAt: json["depositReceivedAt"] as String? ?? "",
@@ -194,12 +192,12 @@ class ExchangeTransactionStatus {
payoutHash: json["payoutHash"] as String? ?? "",
payinExtraId: json["payinExtraId"] as String? ?? "",
payoutExtraId: json["payoutExtraId"] as String? ?? "",
- amountSendDecimal:
- json["amountSend"] == null ? "" : json["amountSend"].toString(),
- amountReceiveDecimal:
- json["amountReceive"] == null
- ? ""
- : json["amountReceive"].toString(),
+ amountSendDecimal: json["amountSend"] == null
+ ? ""
+ : json["amountSend"].toString(),
+ amountReceiveDecimal: json["amountReceive"] == null
+ ? ""
+ : json["amountReceive"].toString(),
tokensDestination: json["tokensDestination"] as String? ?? "",
refundAddress: json["refundAddress"] as String? ?? "",
refundExtraId: json["refundExtraId"] as String? ?? "",
diff --git a/lib/models/exchange/response_objects/trade.dart b/lib/models/exchange/response_objects/trade.dart
index e6f996f..1669b94 100644
--- a/lib/models/exchange/response_objects/trade.dart
+++ b/lib/models/exchange/response_objects/trade.dart
@@ -8,7 +8,7 @@
*
*/
-import 'package:hive/hive.dart';
+import 'package:hive_ce/hive.dart';
import '../../../services/exchange/change_now/change_now_exchange.dart';
import '../change_now/cn_exchange_transaction.dart';
@@ -226,10 +226,9 @@ class Trade {
timestamp: exTx.date,
updatedAt: DateTime.tryParse(exTx.statusObject!.updatedAt) ?? exTx.date,
payInCurrency: exTx.fromCurrency,
- payInAmount:
- exTx.statusObject!.amountSendDecimal.isEmpty
- ? exTx.statusObject!.expectedSendAmountDecimal
- : exTx.statusObject!.amountSendDecimal,
+ payInAmount: exTx.statusObject!.amountSendDecimal.isEmpty
+ ? exTx.statusObject!.expectedSendAmountDecimal
+ : exTx.statusObject!.amountSendDecimal,
payInAddress: exTx.payinAddress,
payInNetwork: "",
payInExtraId: exTx.payinExtraId,
diff --git a/lib/models/lelantus_coin.dart b/lib/models/lelantus_coin.dart
index 6dbce0b..a009b28 100644
--- a/lib/models/lelantus_coin.dart
+++ b/lib/models/lelantus_coin.dart
@@ -8,7 +8,7 @@
*
*/
-import 'package:hive/hive.dart';
+import 'package:hive_ce/hive.dart';
part 'type_adaptors/lelantus_coin.g.dart';
diff --git a/lib/models/mwcmqs_config_model.dart b/lib/models/mwcmqs_config_model.dart
index 067d1a8..eb37702 100644
--- a/lib/models/mwcmqs_config_model.dart
+++ b/lib/models/mwcmqs_config_model.dart
@@ -10,7 +10,7 @@
import 'dart:convert';
-import 'package:hive/hive.dart';
+import 'package:hive_ce/hive.dart';
import 'mwcmqs_server_model.dart';
@@ -23,19 +23,10 @@ class MwcMqsConfigModel {
@HiveField(2)
final int? port;
- MwcMqsConfigModel({
- required this.host,
- this.port
- });
+ MwcMqsConfigModel({required this.host, this.port});
- MwcMqsConfigModel copyWith({
- int? port,
- bool? protocolInsecure,
- }) {
- return MwcMqsConfigModel(
- host: host,
- port: this.port ?? 443,
- );
+ MwcMqsConfigModel copyWith({int? port, bool? protocolInsecure}) {
+ return MwcMqsConfigModel(host: host, port: this.port ?? 443);
}
Map<String, dynamic> toMap() {
@@ -46,10 +37,7 @@ class MwcMqsConfigModel {
}
Map<String, dynamic> toJson() {
- return {
- 'mwcmqs_domain': host,
- 'mwcmqs_port': port,
- };
+ return {'mwcmqs_domain': host, 'mwcmqs_port': port};
}
@override
@@ -69,10 +57,9 @@ class MwcMqsConfigModel {
_mwcmqs['mwcmqs_port'] = _mwcmqs['port'];
}
-
return MwcMqsConfigModel(
host: _mwcmqs['mwcmqs_domain'] as String,
- port: _mwcmqs['mwcmqs_port'] as int
+ port: _mwcmqs['mwcmqs_port'] as int,
);
}
@@ -81,9 +68,6 @@ class MwcMqsConfigModel {
bool? protocolInsecure,
int? addressIndex,
}) {
- return MwcMqsConfigModel(
- host: server.host,
- port: server.port ?? 443
- );
+ return MwcMqsConfigModel(host: server.host, port: server.port ?? 443);
}
}
diff --git a/lib/models/mwcmqs_server_model.dart b/lib/models/mwcmqs_server_model.dart
index c6ffd75..9b5bd5d 100644
--- a/lib/models/mwcmqs_server_model.dart
+++ b/lib/models/mwcmqs_server_model.dart
@@ -8,7 +8,7 @@
*
*/
-import 'package:hive/hive.dart';
+import 'package:hive_ce/hive.dart';
part 'type_adaptors/mwcmqs_server_model.g.dart';
diff --git a/lib/models/node_model.dart b/lib/models/node_model.dart
index 1224d7e..5d43d84 100644
--- a/lib/models/node_model.dart
+++ b/lib/models/node_model.dart
@@ -8,7 +8,7 @@
*
*/
-import 'package:hive/hive.dart';
+import 'package:hive_ce/hive.dart';
import '../utilities/default_nodes.dart';
import '../utilities/flutter_secure_storage_interface.dart';
diff --git a/lib/models/notification_model.dart b/lib/models/notification_model.dart
index 54a7a67..aa56f24 100644
--- a/lib/models/notification_model.dart
+++ b/lib/models/notification_model.dart
@@ -8,7 +8,7 @@
*
*/
-import 'package:hive/hive.dart';
+import 'package:hive_ce/hive.dart';
part 'type_adaptors/notification_model.g.dart';
diff --git a/lib/models/paymint/transactions_model.dart b/lib/models/paymint/transactions_model.dart
index 6cea6f1..e9bbcff 100644
--- a/lib/models/paymint/transactions_model.dart
+++ b/lib/models/paymint/transactions_model.dart
@@ -10,7 +10,7 @@
import 'package:dart_numerics/dart_numerics.dart';
import 'package:decimal/decimal.dart';
-import 'package:hive/hive.dart';
+import 'package:hive_ce/hive.dart';
part '../type_adaptors/transactions_model.g.dart';
@@ -236,7 +236,8 @@ class Transaction {
return Transaction(
txid: json['txid'] as String,
confirmedStatus: json['confirmed_status'] as bool? ?? false,
- timestamp: json['timestamp'] as int? ??
+ timestamp:
+ json['timestamp'] as int? ??
(DateTime.now().millisecondsSinceEpoch ~/ 1000),
txType: json['txType'] as String,
amount: _parse(json["amount"].toString()),
diff --git a/lib/models/paymint/utxo_model.dart b/lib/models/paymint/utxo_model.dart
index 5a8ccff..0d12d3a 100644
--- a/lib/models/paymint/utxo_model.dart
+++ b/lib/models/paymint/utxo_model.dart
@@ -9,7 +9,7 @@
*/
import 'package:dart_numerics/dart_numerics.dart';
-import 'package:hive/hive.dart';
+import 'package:hive_ce/hive.dart';
part '../type_adaptors/utxo_model.g.dart';
diff --git a/lib/models/trade_wallet_lookup.dart b/lib/models/trade_wallet_lookup.dart
index c4bc825..c2a12c9 100644
--- a/lib/models/trade_wallet_lookup.dart
+++ b/lib/models/trade_wallet_lookup.dart
@@ -8,7 +8,7 @@
*
*/
-import 'package:hive/hive.dart';
+import 'package:hive_ce/hive.dart';
part 'type_adaptors/trade_wallet_lookup.g.dart';
diff --git a/lib/utilities/desktop_password_service.dart b/lib/utilities/desktop_password_service.dart
index 3924396..1649a5d 100644
--- a/lib/utilities/desktop_password_service.dart
+++ b/lib/utilities/desktop_password_service.dart
@@ -8,7 +8,7 @@
*
*/
-import 'package:hive/hive.dart' show Box;
+import 'package:hive_ce/hive.dart' show Box;
import 'package:stack_wallet_backup/secure_storage.dart';
import '../db/hive/db.dart';
@@ -68,7 +68,11 @@ class DPS {
await _put(key: _kKeyBlobKey, value: await _handler!.getKeyBlob());
await _updateStoredKeyBlobVersion(kLatestBlobVersion);
} catch (e, s) {
- Logging.instance.e("${_getMessageFromException(e)}\n$s", error: e, stackTrace: s);
+ Logging.instance.e(
+ "${_getMessageFromException(e)}\n$s",
+ error: e,
+ stackTrace: s,
+ );
rethrow;
}
}
@@ -101,7 +105,11 @@ class DPS {
await _updateStoredKeyBlobVersion(kLatestBlobVersion);
}
} catch (e, s) {
- Logging.instance.e("${_getMessageFromException(e)}\n$s", error: e, stackTrace: s);
+ Logging.instance.e(
+ "${_getMessageFromException(e)}\n$s",
+ error: e,
+ stackTrace: s,
+ );
throw Exception(_getMessageFromException(e));
}
}
@@ -119,7 +127,11 @@ class DPS {
// existing passphrase matches key blob
return true;
} catch (e, s) {
- Logging.instance.w("${_getMessageFromException(e)}\n$s", error: e, stackTrace: s,);
+ Logging.instance.w(
+ "${_getMessageFromException(e)}\n$s",
+ error: e,
+ stackTrace: s,
+ );
// password is wrong or some other error
return false;
}
@@ -143,16 +155,17 @@ class DPS {
final blobVersion = await _getStoredKeyBlobVersion();
await _handler!.resetPassphrase(passphraseNew, blobVersion);
- await _put(
- key: _kKeyBlobKey,
- value: await _handler!.getKeyBlob(),
- );
+ await _put(key: _kKeyBlobKey, value: await _handler!.getKeyBlob());
await _updateStoredKeyBlobVersion(blobVersion);
// successfully updated passphrase
return true;
} catch (e, s) {
- Logging.instance.w("${_getMessageFromException(e)}\n$s", error: e, stackTrace: s,);
+ Logging.instance.w(
+ "${_getMessageFromException(e)}\n$s",
+ error: e,
+ stackTrace: s,
+ );
return false;
}
}
diff --git a/pubspec.lock b/pubspec.lock
index ec96051..9af81c8 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -1183,21 +1183,37 @@ packages:
source: hosted
version: "0.2.0"
hive:
- dependency: "direct main"
+ dependency: transitive
description:
name: hive
sha256: "8dcf6db979d7933da8217edcec84e9df1bdb4e4edc7fc77dbd5aa74356d6d941"
url: "https://pub.dev"
source: hosted
version: "2.2.3"
- hive_flutter:
+ hive_ce:
dependency: "direct main"
description:
- name: hive_flutter
- sha256: dca1da446b1d808a51689fb5d0c6c9510c0a2ba01e22805d492c73b68e33eecc
+ name: hive_ce
+ sha256: "89746b555109029a30780e0a601978460b8065643592667f6e43a238faccb8a4"
url: "https://pub.dev"
source: hosted
- version: "1.1.0"
+ version: "2.13.2"
+ hive_ce_flutter:
+ dependency: "direct main"
+ description:
+ name: hive_ce_flutter
+ sha256: f5bd57fda84402bca7557fedb8c629c96c8ea10fab4a542968d7b60864ca02cc
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.3.2"
+ hive_ce_generator:
+ dependency: "direct dev"
+ description:
+ name: hive_ce_generator
+ sha256: a169feeff2da9cc2c417ce5ae9bcebf7c8a95d7a700492b276909016ad70a786
+ url: "https://pub.dev"
+ source: hosted
+ version: "1.9.3"
hive_test:
dependency: "direct dev"
description:
@@ -1315,6 +1331,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.3.0-dev.2"
+ isolate_channel:
+ dependency: transitive
+ description:
+ name: isolate_channel
+ sha256: f3d36f783b301e6b312c3450eeb2656b0e7d1db81331af2a151d9083a3f6b18d
+ url: "https://pub.dev"
+ source: hosted
+ version: "0.2.2+1"
js:
dependency: transitive
description:
@@ -2521,6 +2545,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.1.3"
+ yaml_writer:
+ dependency: transitive
+ description:
+ name: yaml_writer
+ sha256: "69651cd7238411179ac32079937d4aa9a2970150d6b2ae2c6fe6de09402a5dc5"
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.1.0"
zxcvbn:
dependency: "direct main"
description:
diff --git a/scripts/app_config/templates/pubspec.template b/scripts/app_config/templates/pubspec.template
index b95424d..c084b07 100644
--- a/scripts/app_config/templates/pubspec.template
+++ b/scripts/app_config/templates/pubspec.template
@@ -110,8 +110,8 @@ dependencies:
# Storage plugins
flutter_secure_storage: ^8.0.0
- hive: ^2.0.5
- hive_flutter: ^1.1.0
+ hive_ce: ^2.13.2
+ hive_ce_flutter: ^2.3.2
path_provider: ^2.1.5
# UI/Component plugins
@@ -234,7 +234,7 @@ dev_dependencies:
sdk: flutter
build_runner: ^2.5.4
flutter_launcher_icons: ^0.13.1
-# hive_generator: ^2.0.0
+ hive_ce_generator: ^1.9.3
dependency_validator: ^5.0.2
hive_test: ^1.0.1
mockito: ^5.4.6
diff --git a/test/models/type_adapter_tests/lelantus_coin_adapter_test.dart b/test/models/type_adapter_tests/lelantus_coin_adapter_test.dart
index cae7ca8..1def12c 100644
--- a/test/models/type_adapter_tests/lelantus_coin_adapter_test.dart
+++ b/test/models/type_adapter_tests/lelantus_coin_adapter_test.dart
@@ -1,5 +1,5 @@
import 'package:flutter_test/flutter_test.dart';
-import 'package:hive/hive.dart';
+import 'package:hive_ce/hive.dart';
import 'package:mockito/annotations.dart';
import 'package:mockito/mockito.dart';
import 'package:stackwallet/models/lelantus_coin.dart';
diff --git a/test/models/type_adapter_tests/lelantus_coin_adapter_test.mocks.dart b/test/models/type_adapter_tests/lelantus_coin_adapter_test.mocks.dart
index 140c686..e458938 100644
--- a/test/models/type_adapter_tests/lelantus_coin_adapter_test.mocks.dart
+++ b/test/models/type_adapter_tests/lelantus_coin_adapter_test.mocks.dart
@@ -6,8 +6,8 @@
import 'dart:convert' as _i5;
import 'dart:typed_data' as _i4;
-import 'package:hive/hive.dart' as _i3;
-import 'package:hive/src/object/hive_object.dart' as _i1;
+import 'package:hive_ce/hive.dart' as _i3;
+import 'package:hive_ce/src/object/hive_object.dart' as _i1;
import 'package:mockito/mockito.dart' as _i2;
import 'package:mockito/src/dummies.dart' as _i6;
@@ -26,13 +26,8 @@ import 'package:mockito/src/dummies.dart' as _i6;
class _FakeHiveList_0<E extends _i1.HiveObjectMixin> extends _i2.SmartFake
implements _i3.HiveList<E> {
- _FakeHiveList_0(
- Object parent,
- Invocation parentInvocation,
- ) : super(
- parent,
- parentInvocation,
- );
+ _FakeHiveList_0(Object parent, Invocation parentInvocation)
+ : super(parent, parentInvocation);
}
/// A class which mocks [BinaryReader].
@@ -44,106 +39,71 @@ class MockBinaryReader extends _i2.Mock implements _i3.BinaryReader {
}
@override
- int get availableBytes => (super.noSuchMethod(
- Invocation.getter(#availableBytes),
- returnValue: 0,
- ) as int);
+ int get availableBytes =>
+ (super.noSuchMethod(Invocation.getter(#availableBytes), returnValue: 0)
+ as int);
@override
- int get usedBytes => (super.noSuchMethod(
- Invocation.getter(#usedBytes),
- returnValue: 0,
- ) as int);
+ int get usedBytes =>
+ (super.noSuchMethod(Invocation.getter(#usedBytes), returnValue: 0)
+ as int);
@override
void skip(int? bytes) => super.noSuchMethod(
- Invocation.method(
- #skip,
- [bytes],
- ),
- returnValueForMissingStub: null,
- );
+ Invocation.method(#skip, [bytes]),
+ returnValueForMissingStub: null,
+ );
@override
- int readByte() => (super.noSuchMethod(
- Invocation.method(
- #readByte,
- [],
- ),
- returnValue: 0,
- ) as int);
+ int readByte() =>
+ (super.noSuchMethod(Invocation.method(#readByte, []), returnValue: 0)
+ as int);
@override
- _i4.Uint8List viewBytes(int? bytes) => (super.noSuchMethod(
- Invocation.method(
- #viewBytes,
- [bytes],
- ),
- returnValue: _i4.Uint8List(0),
- ) as _i4.Uint8List);
+ _i4.Uint8List viewBytes(int? bytes) =>
+ (super.noSuchMethod(
+ Invocation.method(#viewBytes, [bytes]),
+ returnValue: _i4.Uint8List(0),
+ )
+ as _i4.Uint8List);
@override
- _i4.Uint8List peekBytes(int? bytes) => (super.noSuchMethod(
- Invocation.method(
- #peekBytes,
- [bytes],
- ),
- returnValue: _i4.Uint8List(0),
- ) as _i4.Uint8List);
+ _i4.Uint8List peekBytes(int? bytes) =>
+ (super.noSuchMethod(
+ Invocation.method(#peekBytes, [bytes]),
+ returnValue: _i4.Uint8List(0),
+ )
+ as _i4.Uint8List);
@override
- int readWord() => (super.noSuchMethod(
- Invocation.method(
- #readWord,
- [],
- ),
- returnValue: 0,
- ) as int);
+ int readWord() =>
+ (super.noSuchMethod(Invocation.method(#readWord, []), returnValue: 0)
+ as int);
@override
- int readInt32() => (super.noSuchMethod(
- Invocation.method(
- #readInt32,
- [],
- ),
- returnValue: 0,
- ) as int);
+ int readInt32() =>
+ (super.noSuchMethod(Invocation.method(#readInt32, []), returnValue: 0)
+ as int);
@override
- int readUint32() => (super.noSuchMethod(
- Invocation.method(
- #readUint32,
- [],
- ),
- returnValue: 0,
- ) as int);
+ int readUint32() =>
+ (super.noSuchMethod(Invocation.method(#readUint32, []), returnValue: 0)
+ as int);
@override
- int readInt() => (super.noSuchMethod(
- Invocation.method(
- #readInt,
- [],
- ),
- returnValue: 0,
- ) as int);
+ int readInt() =>
+ (super.noSuchMethod(Invocation.method(#readInt, []), returnValue: 0)
+ as int);
@override
- double readDouble() => (super.noSuchMethod(
- Invocation.method(
- #readDouble,
- [],
- ),
- returnValue: 0.0,
- ) as double);
+ double readDouble() =>
+ (super.noSuchMethod(Invocation.method(#readDouble, []), returnValue: 0.0)
+ as double);
@override
- bool readBool() => (super.noSuchMethod(
- Invocation.method(
- #readBool,
- [],
- ),
- returnValue: false,
- ) as bool);
+ bool readBool() =>
+ (super.noSuchMethod(Invocation.method(#readBool, []), returnValue: false)
+ as bool);
@override
String readString([
@@ -151,60 +111,45 @@ class MockBinaryReader extends _i2.Mock implements _i3.BinaryReader {
_i5.Converter<List<int>, String>? decoder = const _i5.Utf8Decoder(),
]) =>
(super.noSuchMethod(
- Invocation.method(
- #readString,
- [
- byteCount,
- decoder,
- ],
- ),
- returnValue: _i6.dummyValue<String>(
- this,
- Invocation.method(
- #readString,
- [
- byteCount,
- decoder,
- ],
- ),
- ),
- ) as String);
+ Invocation.method(#readString, [byteCount, decoder]),
+ returnValue: _i6.dummyValue<String>(
+ this,
+ Invocation.method(#readString, [byteCount, decoder]),
+ ),
+ )
+ as String);
@override
- _i4.Uint8List readByteList([int? length]) => (super.noSuchMethod(
- Invocation.method(
- #readByteList,
- [length],
- ),
- returnValue: _i4.Uint8List(0),
- ) as _i4.Uint8List);
+ _i4.Uint8List readByteList([int? length]) =>
+ (super.noSuchMethod(
+ Invocation.method(#readByteList, [length]),
+ returnValue: _i4.Uint8List(0),
+ )
+ as _i4.Uint8List);
@override
- List<int> readIntList([int? length]) => (super.noSuchMethod(
- Invocation.method(
- #readIntList,
- [length],
- ),
- returnValue: <int>[],
- ) as List<int>);
+ List<int> readIntList([int? length]) =>
+ (super.noSuchMethod(
+ Invocation.method(#readIntList, [length]),
+ returnValue: <int>[],
+ )
+ as List<int>);
@override
- List<double> readDoubleList([int? length]) => (super.noSuchMethod(
- Invocation.method(
- #readDoubleList,
- [length],
- ),
- returnValue: <double>[],
- ) as List<double>);
+ List<double> readDoubleList([int? length]) =>
+ (super.noSuchMethod(
+ Invocation.method(#readDoubleList, [length]),
+ returnValue: <double>[],
+ )
+ as List<double>);
@override
- List<bool> readBoolList([int? length]) => (super.noSuchMethod(
- Invocation.method(
- #readBoolList,
- [length],
- ),
- returnValue: <bool>[],
- ) as List<bool>);
+ List<bool> readBoolList([int? length]) =>
+ (super.noSuchMethod(
+ Invocation.method(#readBoolList, [length]),
+ returnValue: <bool>[],
+ )
+ as List<bool>);
@override
List<String> readStringList([
@@ -212,49 +157,37 @@ class MockBinaryReader extends _i2.Mock implements _i3.BinaryReader {
_i5.Converter<List<int>, String>? decoder = const _i5.Utf8Decoder(),
]) =>
(super.noSuchMethod(
- Invocation.method(
- #readStringList,
- [
- length,
- decoder,
- ],
- ),
- returnValue: <String>[],
- ) as List<String>);
+ Invocation.method(#readStringList, [length, decoder]),
+ returnValue: <String>[],
+ )
+ as List<String>);
@override
- List<dynamic> readList([int? length]) => (super.noSuchMethod(
- Invocation.method(
- #readList,
- [length],
- ),
- returnValue: <dynamic>[],
- ) as List<dynamic>);
+ List<dynamic> readList([int? length]) =>
+ (super.noSuchMethod(
+ Invocation.method(#readList, [length]),
+ returnValue: <dynamic>[],
+ )
+ as List<dynamic>);
@override
- Map<dynamic, dynamic> readMap([int? length]) => (super.noSuchMethod(
- Invocation.method(
- #readMap,
- [length],
- ),
- returnValue: <dynamic, dynamic>{},
- ) as Map<dynamic, dynamic>);
+ Map<dynamic, dynamic> readMap([int? length]) =>
+ (super.noSuchMethod(
+ Invocation.method(#readMap, [length]),
+ returnValue: <dynamic, dynamic>{},
+ )
+ as Map<dynamic, dynamic>);
@override
_i3.HiveList<_i1.HiveObjectMixin> readHiveList([int? length]) =>
(super.noSuchMethod(
- Invocation.method(
- #readHiveList,
- [length],
- ),
- returnValue: _FakeHiveList_0<_i1.HiveObjectMixin>(
- this,
- Invocation.method(
- #readHiveList,
- [length],
- ),
- ),
- ) as _i3.HiveList<_i1.HiveObjectMixin>);
+ Invocation.method(#readHiveList, [length]),
+ returnValue: _FakeHiveList_0<_i1.HiveObjectMixin>(
+ this,
+ Invocation.method(#readHiveList, [length]),
+ ),
+ )
+ as _i3.HiveList<_i1.HiveObjectMixin>);
}
/// A class which mocks [BinaryWriter].
@@ -267,118 +200,76 @@ class MockBinaryWriter extends _i2.Mock implements _i3.BinaryWriter {
@override
void writeByte(int? byte) => super.noSuchMethod(
- Invocation.method(
- #writeByte,
- [byte],
- ),
- returnValueForMissingStub: null,
- );
+ Invocation.method(#writeByte, [byte]),
+ returnValueForMissingStub: null,
+ );
@override
void writeWord(int? value) => super.noSuchMethod(
- Invocation.method(
- #writeWord,
- [value],
- ),
- returnValueForMissingStub: null,
- );
+ Invocation.method(#writeWord, [value]),
+ returnValueForMissingStub: null,
+ );
@override
void writeInt32(int? value) => super.noSuchMethod(
- Invocation.method(
- #writeInt32,
- [value],
- ),
- returnValueForMissingStub: null,
- );
+ Invocation.method(#writeInt32, [value]),
+ returnValueForMissingStub: null,
+ );
@override
void writeUint32(int? value) => super.noSuchMethod(
- Invocation.method(
- #writeUint32,
- [value],
- ),
- returnValueForMissingStub: null,
- );
+ Invocation.method(#writeUint32, [value]),
+ returnValueForMissingStub: null,
+ );
@override
void writeInt(int? value) => super.noSuchMethod(
- Invocation.method(
- #writeInt,
- [value],
- ),
- returnValueForMissingStub: null,
- );
+ Invocation.method(#writeInt, [value]),
+ returnValueForMissingStub: null,
+ );
@override
void writeDouble(double? value) => super.noSuchMethod(
- Invocation.method(
- #writeDouble,
- [value],
- ),
- returnValueForMissingStub: null,
- );
+ Invocation.method(#writeDouble, [value]),
+ returnValueForMissingStub: null,
+ );
@override
void writeBool(bool? value) => super.noSuchMethod(
- Invocation.method(
- #writeBool,
- [value],
- ),
- returnValueForMissingStub: null,
- );
+ Invocation.method(#writeBool, [value]),
+ returnValueForMissingStub: null,
+ );
@override
void writeString(
String? value, {
bool? writeByteCount = true,
_i5.Converter<String, List<int>>? encoder = const _i5.Utf8Encoder(),
- }) =>
- super.noSuchMethod(
- Invocation.method(
- #writeString,
- [value],
- {
- #writeByteCount: writeByteCount,
- #encoder: encoder,
- },
- ),
- returnValueForMissingStub: null,
- );
+ }) => super.noSuchMethod(
+ Invocation.method(
+ #writeString,
+ [value],
+ {#writeByteCount: writeByteCount, #encoder: encoder},
+ ),
+ returnValueForMissingStub: null,
+ );
@override
- void writeByteList(
- List<int>? bytes, {
- bool? writeLength = true,
- }) =>
+ void writeByteList(List<int>? bytes, {bool? writeLength = true}) =>
super.noSuchMethod(
- Invocation.method(
- #writeByteList,
- [bytes],
- {#writeLength: writeLength},
- ),
+ Invocation.method(#writeByteList, [bytes], {#writeLength: writeLength}),
returnValueForMissingStub: null,
);
@override
- void writeIntList(
- List<int>? list, {
- bool? writeLength = true,
- }) =>
+ void writeIntList(List<int>? list, {bool? writeLength = true}) =>
super.noSuchMethod(
- Invocation.method(
- #writeIntList,
- [list],
- {#writeLength: writeLength},
- ),
+ Invocation.method(#writeIntList, [list], {#writeLength: writeLength}),
returnValueForMissingStub: null,
);
@override
- void writeDoubleList(
- List<double>? list, {
- bool? writeLength = true,
- }) =>
+ void writeDoubleList(List<double>? list, {bool? writeLength = true}) =>
super.noSuchMethod(
Invocation.method(
#writeDoubleList,
@@ -389,16 +280,9 @@ class MockBinaryWriter extends _i2.Mock implements _i3.BinaryWriter {
);
@override
- void writeBoolList(
- List<bool>? list, {
- bool? writeLength = true,
- }) =>
+ void writeBoolList(List<bool>? list, {bool? writeLength = true}) =>
super.noSuchMethod(
- Invocation.method(
- #writeBoolList,
- [list],
- {#writeLength: writeLength},
- ),
+ Invocation.method(#writeBoolList, [list], {#writeLength: writeLength}),
returnValueForMissingStub: null,
);
@@ -407,44 +291,26 @@ class MockBinaryWriter extends _i2.Mock implements _i3.BinaryWriter {
List<String>? list, {
bool? writeLength = true,
_i5.Converter<String, List<int>>? encoder = const _i5.Utf8Encoder(),
- }) =>
- super.noSuchMethod(
- Invocation.method(
- #writeStringList,
- [list],
- {
- #writeLength: writeLength,
- #encoder: encoder,
- },
- ),
- returnValueForMissingStub: null,
- );
+ }) => super.noSuchMethod(
+ Invocation.method(
+ #writeStringList,
+ [list],
+ {#writeLength: writeLength, #encoder: encoder},
+ ),
+ returnValueForMissingStub: null,
+ );
@override
- void writeList(
- List<dynamic>? list, {
- bool? writeLength = true,
- }) =>
+ void writeList(List<dynamic>? list, {bool? writeLength = true}) =>
super.noSuchMethod(
- Invocation.method(
- #writeList,
- [list],
- {#writeLength: writeLength},
- ),
+ Invocation.method(#writeList, [list], {#writeLength: writeLength}),
returnValueForMissingStub: null,
);
@override
- void writeMap(
- Map<dynamic, dynamic>? map, {
- bool? writeLength = true,
- }) =>
+ void writeMap(Map<dynamic, dynamic>? map, {bool? writeLength = true}) =>
super.noSuchMethod(
- Invocation.method(
- #writeMap,
- [map],
- {#writeLength: writeLength},
- ),
+ Invocation.method(#writeMap, [map], {#writeLength: writeLength}),
returnValueForMissingStub: null,
);
@@ -452,27 +318,14 @@ class MockBinaryWriter extends _i2.Mock implements _i3.BinaryWriter {
void writeHiveList(
_i3.HiveList<_i1.HiveObjectMixin>? list, {
bool? writeLength = true,
- }) =>
- super.noSuchMethod(
- Invocation.method(
- #writeHiveList,
- [list],
- {#writeLength: writeLength},
- ),
- returnValueForMissingStub: null,
- );
+ }) => super.noSuchMethod(
+ Invocation.method(#writeHiveList, [list], {#writeLength: writeLength}),
+ returnValueForMissingStub: null,
+ );
@override
- void write<T>(
- T? value, {
- bool? writeTypeId = true,
- }) =>
- super.noSuchMethod(
- Invocation.method(
- #write,
- [value],
- {#writeTypeId: writeTypeId},
- ),
- returnValueForMissingStub: null,
- );
+ void write<T>(T? value, {bool? writeTypeId = true}) => super.noSuchMethod(
+ Invocation.method(#write, [value], {#writeTypeId: writeTypeId}),
+ returnValueForMissingStub: null,
+ );
}
diff --git a/test/models/type_adapter_tests/transactions_model_adapter_test.dart b/test/models/type_adapter_tests/transactions_model_adapter_test.dart
index 265cdc1..e057b61 100644
--- a/test/models/type_adapter_tests/transactions_model_adapter_test.dart
+++ b/test/models/type_adapter_tests/transactions_model_adapter_test.dart
@@ -1,5 +1,5 @@
import 'package:flutter_test/flutter_test.dart';
-import 'package:hive/hive.dart';
+import 'package:hive_ce/hive.dart';
import 'package:mockito/annotations.dart';
import 'package:mockito/mockito.dart';
import 'package:stackwallet/models/lelantus_coin.dart';
@@ -104,10 +104,7 @@ void main() {
when(reader.readByte()).thenAnswer((_) => readByteResponses.removeAt(0));
- final List<dynamic> readResponses = [
- 3426523234,
- <Transaction>[],
- ];
+ final List<dynamic> readResponses = [3426523234, <Transaction>[]];
when(reader.read()).thenAnswer((_) => readResponses.removeAt(0));
@@ -214,10 +211,7 @@ void main() {
3794,
3794,
4,
- [
- Input(txid: "abc", vout: 1),
- Input(txid: "abc", vout: 1),
- ],
+ [Input(txid: "abc", vout: 1), Input(txid: "abc", vout: 1)],
[
Output(scriptpubkeyAddress: "adr", value: 1),
Output(scriptpubkeyAddress: "adr", value: 1),
diff --git a/test/models/type_adapter_tests/transactions_model_adapter_test.mocks.dart b/test/models/type_adapter_tests/transactions_model_adapter_test.mocks.dart
index ad9f995..d68fd1e 100644
--- a/test/models/type_adapter_tests/transactions_model_adapter_test.mocks.dart
+++ b/test/models/type_adapter_tests/transactions_model_adapter_test.mocks.dart
@@ -6,8 +6,8 @@
import 'dart:convert' as _i5;
import 'dart:typed_data' as _i4;
-import 'package:hive/hive.dart' as _i3;
-import 'package:hive/src/object/hive_object.dart' as _i1;
+import 'package:hive_ce/hive.dart' as _i3;
+import 'package:hive_ce/src/object/hive_object.dart' as _i1;
import 'package:mockito/mockito.dart' as _i2;
import 'package:mockito/src/dummies.dart' as _i6;
@@ -26,13 +26,8 @@ import 'package:mockito/src/dummies.dart' as _i6;
class _FakeHiveList_0<E extends _i1.HiveObjectMixin> extends _i2.SmartFake
implements _i3.HiveList<E> {
- _FakeHiveList_0(
- Object parent,
- Invocation parentInvocation,
- ) : super(
- parent,
- parentInvocation,
- );
+ _FakeHiveList_0(Object parent, Invocation parentInvocation)
+ : super(parent, parentInvocation);
}
/// A class which mocks [BinaryReader].
@@ -44,106 +39,71 @@ class MockBinaryReader extends _i2.Mock implements _i3.BinaryReader {
}
@override
- int get availableBytes => (super.noSuchMethod(
- Invocation.getter(#availableBytes),
- returnValue: 0,
- ) as int);
+ int get availableBytes =>
+ (super.noSuchMethod(Invocation.getter(#availableBytes), returnValue: 0)
+ as int);
@override
- int get usedBytes => (super.noSuchMethod(
- Invocation.getter(#usedBytes),
- returnValue: 0,
- ) as int);
+ int get usedBytes =>
+ (super.noSuchMethod(Invocation.getter(#usedBytes), returnValue: 0)
+ as int);
@override
void skip(int? bytes) => super.noSuchMethod(
- Invocation.method(
- #skip,
- [bytes],
- ),
- returnValueForMissingStub: null,
- );
+ Invocation.method(#skip, [bytes]),
+ returnValueForMissingStub: null,
+ );
@override
- int readByte() => (super.noSuchMethod(
- Invocation.method(
- #readByte,
- [],
- ),
- returnValue: 0,
- ) as int);
+ int readByte() =>
+ (super.noSuchMethod(Invocation.method(#readByte, []), returnValue: 0)
+ as int);
@override
- _i4.Uint8List viewBytes(int? bytes) => (super.noSuchMethod(
- Invocation.method(
- #viewBytes,
- [bytes],
- ),
- returnValue: _i4.Uint8List(0),
- ) as _i4.Uint8List);
+ _i4.Uint8List viewBytes(int? bytes) =>
+ (super.noSuchMethod(
+ Invocation.method(#viewBytes, [bytes]),
+ returnValue: _i4.Uint8List(0),
+ )
+ as _i4.Uint8List);
@override
- _i4.Uint8List peekBytes(int? bytes) => (super.noSuchMethod(
- Invocation.method(
- #peekBytes,
- [bytes],
- ),
- returnValue: _i4.Uint8List(0),
- ) as _i4.Uint8List);
+ _i4.Uint8List peekBytes(int? bytes) =>
+ (super.noSuchMethod(
+ Invocation.method(#peekBytes, [bytes]),
+ returnValue: _i4.Uint8List(0),
+ )
+ as _i4.Uint8List);
@override
- int readWord() => (super.noSuchMethod(
- Invocation.method(
- #readWord,
- [],
- ),
- returnValue: 0,
- ) as int);
+ int readWord() =>
+ (super.noSuchMethod(Invocation.method(#readWord, []), returnValue: 0)
+ as int);
@override
- int readInt32() => (super.noSuchMethod(
- Invocation.method(
- #readInt32,
- [],
- ),
- returnValue: 0,
- ) as int);
+ int readInt32() =>
+ (super.noSuchMethod(Invocation.method(#readInt32, []), returnValue: 0)
+ as int);
@override
- int readUint32() => (super.noSuchMethod(
- Invocation.method(
- #readUint32,
- [],
- ),
- returnValue: 0,
- ) as int);
+ int readUint32() =>
+ (super.noSuchMethod(Invocation.method(#readUint32, []), returnValue: 0)
+ as int);
@override
- int readInt() => (super.noSuchMethod(
- Invocation.method(
- #readInt,
- [],
- ),
- returnValue: 0,
- ) as int);
+ int readInt() =>
+ (super.noSuchMethod(Invocation.method(#readInt, []), returnValue: 0)
+ as int);
@override
- double readDouble() => (super.noSuchMethod(
- Invocation.method(
- #readDouble,
- [],
- ),
- returnValue: 0.0,
- ) as double);
+ double readDouble() =>
+ (super.noSuchMethod(Invocation.method(#readDouble, []), returnValue: 0.0)
+ as double);
@override
- bool readBool() => (super.noSuchMethod(
- Invocation.method(
- #readBool,
- [],
- ),
- returnValue: false,
- ) as bool);
+ bool readBool() =>
+ (super.noSuchMethod(Invocation.method(#readBool, []), returnValue: false)
+ as bool);
@override
String readString([
@@ -151,60 +111,45 @@ class MockBinaryReader extends _i2.Mock implements _i3.BinaryReader {
_i5.Converter<List<int>, String>? decoder = const _i5.Utf8Decoder(),
]) =>
(super.noSuchMethod(
- Invocation.method(
- #readString,
- [
- byteCount,
- decoder,
- ],
- ),
- returnValue: _i6.dummyValue<String>(
- this,
- Invocation.method(
- #readString,
- [
- byteCount,
- decoder,
- ],
- ),
- ),
- ) as String);
+ Invocation.method(#readString, [byteCount, decoder]),
+ returnValue: _i6.dummyValue<String>(
+ this,
+ Invocation.method(#readString, [byteCount, decoder]),
+ ),
+ )
+ as String);
@override
- _i4.Uint8List readByteList([int? length]) => (super.noSuchMethod(
- Invocation.method(
- #readByteList,
- [length],
- ),
- returnValue: _i4.Uint8List(0),
- ) as _i4.Uint8List);
+ _i4.Uint8List readByteList([int? length]) =>
+ (super.noSuchMethod(
+ Invocation.method(#readByteList, [length]),
+ returnValue: _i4.Uint8List(0),
+ )
+ as _i4.Uint8List);
@override
- List<int> readIntList([int? length]) => (super.noSuchMethod(
- Invocation.method(
- #readIntList,
- [length],
- ),
- returnValue: <int>[],
- ) as List<int>);
+ List<int> readIntList([int? length]) =>
+ (super.noSuchMethod(
+ Invocation.method(#readIntList, [length]),
+ returnValue: <int>[],
+ )
+ as List<int>);
@override
- List<double> readDoubleList([int? length]) => (super.noSuchMethod(
- Invocation.method(
- #readDoubleList,
- [length],
- ),
- returnValue: <double>[],
- ) as List<double>);
+ List<double> readDoubleList([int? length]) =>
+ (super.noSuchMethod(
+ Invocation.method(#readDoubleList, [length]),
+ returnValue: <double>[],
+ )
+ as List<double>);
@override
- List<bool> readBoolList([int? length]) => (super.noSuchMethod(
- Invocation.method(
- #readBoolList,
- [length],
- ),
- returnValue: <bool>[],
- ) as List<bool>);
+ List<bool> readBoolList([int? length]) =>
+ (super.noSuchMethod(
+ Invocation.method(#readBoolList, [length]),
+ returnValue: <bool>[],
+ )
+ as List<bool>);
@override
List<String> readStringList([
@@ -212,49 +157,37 @@ class MockBinaryReader extends _i2.Mock implements _i3.BinaryReader {
_i5.Converter<List<int>, String>? decoder = const _i5.Utf8Decoder(),
]) =>
(super.noSuchMethod(
- Invocation.method(
- #readStringList,
- [
- length,
- decoder,
- ],
- ),
- returnValue: <String>[],
- ) as List<String>);
+ Invocation.method(#readStringList, [length, decoder]),
+ returnValue: <String>[],
+ )
+ as List<String>);
@override
- List<dynamic> readList([int? length]) => (super.noSuchMethod(
- Invocation.method(
- #readList,
- [length],
- ),
- returnValue: <dynamic>[],
- ) as List<dynamic>);
+ List<dynamic> readList([int? length]) =>
+ (super.noSuchMethod(
+ Invocation.method(#readList, [length]),
+ returnValue: <dynamic>[],
+ )
+ as List<dynamic>);
@override
- Map<dynamic, dynamic> readMap([int? length]) => (super.noSuchMethod(
- Invocation.method(
- #readMap,
- [length],
- ),
- returnValue: <dynamic, dynamic>{},
- ) as Map<dynamic, dynamic>);
+ Map<dynamic, dynamic> readMap([int? length]) =>
+ (super.noSuchMethod(
+ Invocation.method(#readMap, [length]),
+ returnValue: <dynamic, dynamic>{},
+ )
+ as Map<dynamic, dynamic>);
@override
_i3.HiveList<_i1.HiveObjectMixin> readHiveList([int? length]) =>
(super.noSuchMethod(
- Invocation.method(
- #readHiveList,
- [length],
- ),
- returnValue: _FakeHiveList_0<_i1.HiveObjectMixin>(
- this,
- Invocation.method(
- #readHiveList,
- [length],
- ),
- ),
- ) as _i3.HiveList<_i1.HiveObjectMixin>);
+ Invocation.method(#readHiveList, [length]),
+ returnValue: _FakeHiveList_0<_i1.HiveObjectMixin>(
+ this,
+ Invocation.method(#readHiveList, [length]),
+ ),
+ )
+ as _i3.HiveList<_i1.HiveObjectMixin>);
}
/// A class which mocks [BinaryWriter].
@@ -267,118 +200,76 @@ class MockBinaryWriter extends _i2.Mock implements _i3.BinaryWriter {
@override
void writeByte(int? byte) => super.noSuchMethod(
- Invocation.method(
- #writeByte,
- [byte],
- ),
- returnValueForMissingStub: null,
- );
+ Invocation.method(#writeByte, [byte]),
+ returnValueForMissingStub: null,
+ );
@override
void writeWord(int? value) => super.noSuchMethod(
- Invocation.method(
- #writeWord,
- [value],
- ),
- returnValueForMissingStub: null,
- );
+ Invocation.method(#writeWord, [value]),
+ returnValueForMissingStub: null,
+ );
@override
void writeInt32(int? value) => super.noSuchMethod(
- Invocation.method(
- #writeInt32,
- [value],
- ),
- returnValueForMissingStub: null,
- );
+ Invocation.method(#writeInt32, [value]),
+ returnValueForMissingStub: null,
+ );
@override
void writeUint32(int? value) => super.noSuchMethod(
- Invocation.method(
- #writeUint32,
- [value],
- ),
- returnValueForMissingStub: null,
- );
+ Invocation.method(#writeUint32, [value]),
+ returnValueForMissingStub: null,
+ );
@override
void writeInt(int? value) => super.noSuchMethod(
- Invocation.method(
- #writeInt,
- [value],
- ),
- returnValueForMissingStub: null,
- );
+ Invocation.method(#writeInt, [value]),
+ returnValueForMissingStub: null,
+ );
@override
void writeDouble(double? value) => super.noSuchMethod(
- Invocation.method(
- #writeDouble,
- [value],
- ),
- returnValueForMissingStub: null,
- );
+ Invocation.method(#writeDouble, [value]),
+ returnValueForMissingStub: null,
+ );
@override
void writeBool(bool? value) => super.noSuchMethod(
- Invocation.method(
- #writeBool,
- [value],
- ),
- returnValueForMissingStub: null,
- );
+ Invocation.method(#writeBool, [value]),
+ returnValueForMissingStub: null,
+ );
@override
void writeString(
String? value, {
bool? writeByteCount = true,
_i5.Converter<String, List<int>>? encoder = const _i5.Utf8Encoder(),
- }) =>
- super.noSuchMethod(
- Invocation.method(
- #writeString,
- [value],
- {
- #writeByteCount: writeByteCount,
- #encoder: encoder,
- },
- ),
- returnValueForMissingStub: null,
- );
+ }) => super.noSuchMethod(
+ Invocation.method(
+ #writeString,
+ [value],
+ {#writeByteCount: writeByteCount, #encoder: encoder},
+ ),
+ returnValueForMissingStub: null,
+ );
@override
- void writeByteList(
- List<int>? bytes, {
- bool? writeLength = true,
- }) =>
+ void writeByteList(List<int>? bytes, {bool? writeLength = true}) =>
super.noSuchMethod(
- Invocation.method(
- #writeByteList,
- [bytes],
- {#writeLength: writeLength},
- ),
+ Invocation.method(#writeByteList, [bytes], {#writeLength: writeLength}),
returnValueForMissingStub: null,
);
@override
- void writeIntList(
- List<int>? list, {
- bool? writeLength = true,
- }) =>
+ void writeIntList(List<int>? list, {bool? writeLength = true}) =>
super.noSuchMethod(
- Invocation.method(
- #writeIntList,
- [list],
- {#writeLength: writeLength},
- ),
+ Invocation.method(#writeIntList, [list], {#writeLength: writeLength}),
returnValueForMissingStub: null,
);
@override
- void writeDoubleList(
- List<double>? list, {
- bool? writeLength = true,
- }) =>
+ void writeDoubleList(List<double>? list, {bool? writeLength = true}) =>
super.noSuchMethod(
Invocation.method(
#writeDoubleList,
@@ -389,16 +280,9 @@ class MockBinaryWriter extends _i2.Mock implements _i3.BinaryWriter {
);
@override
- void writeBoolList(
- List<bool>? list, {
- bool? writeLength = true,
- }) =>
+ void writeBoolList(List<bool>? list, {bool? writeLength = true}) =>
super.noSuchMethod(
- Invocation.method(
- #writeBoolList,
- [list],
- {#writeLength: writeLength},
- ),
+ Invocation.method(#writeBoolList, [list], {#writeLength: writeLength}),
returnValueForMissingStub: null,
);
@@ -407,44 +291,26 @@ class MockBinaryWriter extends _i2.Mock implements _i3.BinaryWriter {
List<String>? list, {
bool? writeLength = true,
_i5.Converter<String, List<int>>? encoder = const _i5.Utf8Encoder(),
- }) =>
- super.noSuchMethod(
- Invocation.method(
- #writeStringList,
- [list],
- {
- #writeLength: writeLength,
- #encoder: encoder,
- },
- ),
- returnValueForMissingStub: null,
- );
+ }) => super.noSuchMethod(
+ Invocation.method(
+ #writeStringList,
+ [list],
+ {#writeLength: writeLength, #encoder: encoder},
+ ),
+ returnValueForMissingStub: null,
+ );
@override
- void writeList(
- List<dynamic>? list, {
- bool? writeLength = true,
- }) =>
+ void writeList(List<dynamic>? list, {bool? writeLength = true}) =>
super.noSuchMethod(
- Invocation.method(
- #writeList,
- [list],
- {#writeLength: writeLength},
- ),
+ Invocation.method(#writeList, [list], {#writeLength: writeLength}),
returnValueForMissingStub: null,
);
@override
- void writeMap(
- Map<dynamic, dynamic>? map, {
- bool? writeLength = true,
- }) =>
+ void writeMap(Map<dynamic, dynamic>? map, {bool? writeLength = true}) =>
super.noSuchMethod(
- Invocation.method(
- #writeMap,
- [map],
- {#writeLength: writeLength},
- ),
+ Invocation.method(#writeMap, [map], {#writeLength: writeLength}),
returnValueForMissingStub: null,
);
@@ -452,27 +318,14 @@ class MockBinaryWriter extends _i2.Mock implements _i3.BinaryWriter {
void writeHiveList(
_i3.HiveList<_i1.HiveObjectMixin>? list, {
bool? writeLength = true,
- }) =>
- super.noSuchMethod(
- Invocation.method(
- #writeHiveList,
- [list],
- {#writeLength: writeLength},
- ),
- returnValueForMissingStub: null,
- );
+ }) => super.noSuchMethod(
+ Invocation.method(#writeHiveList, [list], {#writeLength: writeLength}),
+ returnValueForMissingStub: null,
+ );
@override
- void write<T>(
- T? value, {
- bool? writeTypeId = true,
- }) =>
- super.noSuchMethod(
- Invocation.method(
- #write,
- [value],
- {#writeTypeId: writeTypeId},
- ),
- returnValueForMissingStub: null,
- );
+ void write<T>(T? value, {bool? writeTypeId = true}) => super.noSuchMethod(
+ Invocation.method(#write, [value], {#writeTypeId: writeTypeId}),
+ returnValueForMissingStub: null,
+ );
}
diff --git a/test/models/type_adapter_tests/utxo_model_adapter_test.dart b/test/models/type_adapter_tests/utxo_model_adapter_test.dart
index 5849c61..a7789e1 100644
--- a/test/models/type_adapter_tests/utxo_model_adapter_test.dart
+++ b/test/models/type_adapter_tests/utxo_model_adapter_test.dart
@@ -1,5 +1,5 @@
import 'package:flutter_test/flutter_test.dart';
-import 'package:hive/hive.dart';
+import 'package:hive_ce/hive.dart';
import 'package:mockito/annotations.dart';
import 'package:mockito/mockito.dart';
import 'package:stackwallet/models/paymint/transactions_model.dart';
diff --git a/test/models/type_adapter_tests/utxo_model_adapter_test.mocks.dart b/test/models/type_adapter_tests/utxo_model_adapter_test.mocks.dart
index 983ffb1..fc00678 100644
--- a/test/models/type_adapter_tests/utxo_model_adapter_test.mocks.dart
+++ b/test/models/type_adapter_tests/utxo_model_adapter_test.mocks.dart
@@ -6,8 +6,8 @@
import 'dart:convert' as _i5;
import 'dart:typed_data' as _i4;
-import 'package:hive/hive.dart' as _i3;
-import 'package:hive/src/object/hive_object.dart' as _i1;
+import 'package:hive_ce/hive.dart' as _i3;
+import 'package:hive_ce/src/object/hive_object.dart' as _i1;
import 'package:mockito/mockito.dart' as _i2;
import 'package:mockito/src/dummies.dart' as _i6;
@@ -26,13 +26,8 @@ import 'package:mockito/src/dummies.dart' as _i6;
class _FakeHiveList_0<E extends _i1.HiveObjectMixin> extends _i2.SmartFake
implements _i3.HiveList<E> {
- _FakeHiveList_0(
- Object parent,
- Invocation parentInvocation,
- ) : super(
- parent,
- parentInvocation,
- );
+ _FakeHiveList_0(Object parent, Invocation parentInvocation)
+ : super(parent, parentInvocation);
}
/// A class which mocks [BinaryReader].
@@ -44,106 +39,71 @@ class MockBinaryReader extends _i2.Mock implements _i3.BinaryReader {
}
@override
- int get availableBytes => (super.noSuchMethod(
- Invocation.getter(#availableBytes),
- returnValue: 0,
- ) as int);
+ int get availableBytes =>
+ (super.noSuchMethod(Invocation.getter(#availableBytes), returnValue: 0)
+ as int);
@override
- int get usedBytes => (super.noSuchMethod(
- Invocation.getter(#usedBytes),
- returnValue: 0,
- ) as int);
+ int get usedBytes =>
+ (super.noSuchMethod(Invocation.getter(#usedBytes), returnValue: 0)
+ as int);
@override
void skip(int? bytes) => super.noSuchMethod(
- Invocation.method(
- #skip,
- [bytes],
- ),
- returnValueForMissingStub: null,
- );
+ Invocation.method(#skip, [bytes]),
+ returnValueForMissingStub: null,
+ );
@override
- int readByte() => (super.noSuchMethod(
- Invocation.method(
- #readByte,
- [],
- ),
- returnValue: 0,
- ) as int);
+ int readByte() =>
+ (super.noSuchMethod(Invocation.method(#readByte, []), returnValue: 0)
+ as int);
@override
- _i4.Uint8List viewBytes(int? bytes) => (super.noSuchMethod(
- Invocation.method(
- #viewBytes,
- [bytes],
- ),
- returnValue: _i4.Uint8List(0),
- ) as _i4.Uint8List);
+ _i4.Uint8List viewBytes(int? bytes) =>
+ (super.noSuchMethod(
+ Invocation.method(#viewBytes, [bytes]),
+ returnValue: _i4.Uint8List(0),
+ )
+ as _i4.Uint8List);
@override
- _i4.Uint8List peekBytes(int? bytes) => (super.noSuchMethod(
- Invocation.method(
- #peekBytes,
- [bytes],
- ),
- returnValue: _i4.Uint8List(0),
- ) as _i4.Uint8List);
+ _i4.Uint8List peekBytes(int? bytes) =>
+ (super.noSuchMethod(
+ Invocation.method(#peekBytes, [bytes]),
+ returnValue: _i4.Uint8List(0),
+ )
+ as _i4.Uint8List);
@override
- int readWord() => (super.noSuchMethod(
- Invocation.method(
- #readWord,
- [],
- ),
- returnValue: 0,
- ) as int);
+ int readWord() =>
+ (super.noSuchMethod(Invocation.method(#readWord, []), returnValue: 0)
+ as int);
@override
- int readInt32() => (super.noSuchMethod(
- Invocation.method(
- #readInt32,
- [],
- ),
- returnValue: 0,
- ) as int);
+ int readInt32() =>
+ (super.noSuchMethod(Invocation.method(#readInt32, []), returnValue: 0)
+ as int);
@override
- int readUint32() => (super.noSuchMethod(
- Invocation.method(
- #readUint32,
- [],
- ),
- returnValue: 0,
- ) as int);
+ int readUint32() =>
+ (super.noSuchMethod(Invocation.method(#readUint32, []), returnValue: 0)
+ as int);
@override
- int readInt() => (super.noSuchMethod(
- Invocation.method(
- #readInt,
- [],
- ),
- returnValue: 0,
- ) as int);
+ int readInt() =>
+ (super.noSuchMethod(Invocation.method(#readInt, []), returnValue: 0)
+ as int);
@override
- double readDouble() => (super.noSuchMethod(
- Invocation.method(
- #readDouble,
- [],
- ),
- returnValue: 0.0,
- ) as double);
+ double readDouble() =>
+ (super.noSuchMethod(Invocation.method(#readDouble, []), returnValue: 0.0)
+ as double);
@override
- bool readBool() => (super.noSuchMethod(
- Invocation.method(
- #readBool,
- [],
- ),
- returnValue: false,
- ) as bool);
+ bool readBool() =>
+ (super.noSuchMethod(Invocation.method(#readBool, []), returnValue: false)
+ as bool);
@override
String readString([
@@ -151,60 +111,45 @@ class MockBinaryReader extends _i2.Mock implements _i3.BinaryReader {
_i5.Converter<List<int>, String>? decoder = const _i5.Utf8Decoder(),
]) =>
(super.noSuchMethod(
- Invocation.method(
- #readString,
- [
- byteCount,
- decoder,
- ],
- ),
- returnValue: _i6.dummyValue<String>(
- this,
- Invocation.method(
- #readString,
- [
- byteCount,
- decoder,
- ],
- ),
- ),
- ) as String);
+ Invocation.method(#readString, [byteCount, decoder]),
+ returnValue: _i6.dummyValue<String>(
+ this,
+ Invocation.method(#readString, [byteCount, decoder]),
+ ),
+ )
+ as String);
@override
- _i4.Uint8List readByteList([int? length]) => (super.noSuchMethod(
- Invocation.method(
- #readByteList,
- [length],
- ),
- returnValue: _i4.Uint8List(0),
- ) as _i4.Uint8List);
+ _i4.Uint8List readByteList([int? length]) =>
+ (super.noSuchMethod(
+ Invocation.method(#readByteList, [length]),
+ returnValue: _i4.Uint8List(0),
+ )
+ as _i4.Uint8List);
@override
- List<int> readIntList([int? length]) => (super.noSuchMethod(
- Invocation.method(
- #readIntList,
- [length],
- ),
- returnValue: <int>[],
- ) as List<int>);
+ List<int> readIntList([int? length]) =>
+ (super.noSuchMethod(
+ Invocation.method(#readIntList, [length]),
+ returnValue: <int>[],
+ )
+ as List<int>);
@override
- List<double> readDoubleList([int? length]) => (super.noSuchMethod(
- Invocation.method(
- #readDoubleList,
- [length],
- ),
- returnValue: <double>[],
- ) as List<double>);
+ List<double> readDoubleList([int? length]) =>
+ (super.noSuchMethod(
+ Invocation.method(#readDoubleList, [length]),
+ returnValue: <double>[],
+ )
+ as List<double>);
@override
- List<bool> readBoolList([int? length]) => (super.noSuchMethod(
- Invocation.method(
- #readBoolList,
- [length],
- ),
- returnValue: <bool>[],
- ) as List<bool>);
+ List<bool> readBoolList([int? length]) =>
+ (super.noSuchMethod(
+ Invocation.method(#readBoolList, [length]),
+ returnValue: <bool>[],
+ )
+ as List<bool>);
@override
List<String> readStringList([
@@ -212,49 +157,37 @@ class MockBinaryReader extends _i2.Mock implements _i3.BinaryReader {
_i5.Converter<List<int>, String>? decoder = const _i5.Utf8Decoder(),
]) =>
(super.noSuchMethod(
- Invocation.method(
- #readStringList,
- [
- length,
- decoder,
- ],
- ),
- returnValue: <String>[],
- ) as List<String>);
+ Invocation.method(#readStringList, [length, decoder]),
+ returnValue: <String>[],
+ )
+ as List<String>);
@override
- List<dynamic> readList([int? length]) => (super.noSuchMethod(
- Invocation.method(
- #readList,
- [length],
- ),
- returnValue: <dynamic>[],
- ) as List<dynamic>);
+ List<dynamic> readList([int? length]) =>
+ (super.noSuchMethod(
+ Invocation.method(#readList, [length]),
+ returnValue: <dynamic>[],
+ )
+ as List<dynamic>);
@override
- Map<dynamic, dynamic> readMap([int? length]) => (super.noSuchMethod(
- Invocation.method(
- #readMap,
- [length],
- ),
- returnValue: <dynamic, dynamic>{},
- ) as Map<dynamic, dynamic>);
+ Map<dynamic, dynamic> readMap([int? length]) =>
+ (super.noSuchMethod(
+ Invocation.method(#readMap, [length]),
+ returnValue: <dynamic, dynamic>{},
+ )
+ as Map<dynamic, dynamic>);
@override
_i3.HiveList<_i1.HiveObjectMixin> readHiveList([int? length]) =>
(super.noSuchMethod(
- Invocation.method(
- #readHiveList,
- [length],
- ),
- returnValue: _FakeHiveList_0<_i1.HiveObjectMixin>(
- this,
- Invocation.method(
- #readHiveList,
- [length],
- ),
- ),
- ) as _i3.HiveList<_i1.HiveObjectMixin>);
+ Invocation.method(#readHiveList, [length]),
+ returnValue: _FakeHiveList_0<_i1.HiveObjectMixin>(
+ this,
+ Invocation.method(#readHiveList, [length]),
+ ),
+ )
+ as _i3.HiveList<_i1.HiveObjectMixin>);
}
/// A class which mocks [BinaryWriter].
@@ -267,118 +200,76 @@ class MockBinaryWriter extends _i2.Mock implements _i3.BinaryWriter {
@override
void writeByte(int? byte) => super.noSuchMethod(
- Invocation.method(
- #writeByte,
- [byte],
- ),
- returnValueForMissingStub: null,
- );
+ Invocation.method(#writeByte, [byte]),
+ returnValueForMissingStub: null,
+ );
@override
void writeWord(int? value) => super.noSuchMethod(
- Invocation.method(
- #writeWord,
- [value],
- ),
- returnValueForMissingStub: null,
- );
+ Invocation.method(#writeWord, [value]),
+ returnValueForMissingStub: null,
+ );
@override
void writeInt32(int? value) => super.noSuchMethod(
- Invocation.method(
- #writeInt32,
- [value],
- ),
- returnValueForMissingStub: null,
- );
+ Invocation.method(#writeInt32, [value]),
+ returnValueForMissingStub: null,
+ );
@override
void writeUint32(int? value) => super.noSuchMethod(
- Invocation.method(
- #writeUint32,
- [value],
- ),
- returnValueForMissingStub: null,
- );
+ Invocation.method(#writeUint32, [value]),
+ returnValueForMissingStub: null,
+ );
@override
void writeInt(int? value) => super.noSuchMethod(
- Invocation.method(
- #writeInt,
- [value],
- ),
- returnValueForMissingStub: null,
- );
+ Invocation.method(#writeInt, [value]),
+ returnValueForMissingStub: null,
+ );
@override
void writeDouble(double? value) => super.noSuchMethod(
- Invocation.method(
- #writeDouble,
- [value],
- ),
- returnValueForMissingStub: null,
- );
+ Invocation.method(#writeDouble, [value]),
+ returnValueForMissingStub: null,
+ );
@override
void writeBool(bool? value) => super.noSuchMethod(
- Invocation.method(
- #writeBool,
- [value],
- ),
- returnValueForMissingStub: null,
- );
+ Invocation.method(#writeBool, [value]),
+ returnValueForMissingStub: null,
+ );
@override
void writeString(
String? value, {
bool? writeByteCount = true,
_i5.Converter<String, List<int>>? encoder = const _i5.Utf8Encoder(),
- }) =>
- super.noSuchMethod(
- Invocation.method(
- #writeString,
- [value],
- {
- #writeByteCount: writeByteCount,
- #encoder: encoder,
- },
- ),
- returnValueForMissingStub: null,
- );
+ }) => super.noSuchMethod(
+ Invocation.method(
+ #writeString,
+ [value],
+ {#writeByteCount: writeByteCount, #encoder: encoder},
+ ),
+ returnValueForMissingStub: null,
+ );
@override
- void writeByteList(
- List<int>? bytes, {
- bool? writeLength = true,
- }) =>
+ void writeByteList(List<int>? bytes, {bool? writeLength = true}) =>
super.noSuchMethod(
- Invocation.method(
- #writeByteList,
- [bytes],
- {#writeLength: writeLength},
- ),
+ Invocation.method(#writeByteList, [bytes], {#writeLength: writeLength}),
returnValueForMissingStub: null,
);
@override
- void writeIntList(
- List<int>? list, {
- bool? writeLength = true,
- }) =>
+ void writeIntList(List<int>? list, {bool? writeLength = true}) =>
super.noSuchMethod(
- Invocation.method(
- #writeIntList,
- [list],
- {#writeLength: writeLength},
- ),
+ Invocation.method(#writeIntList, [list], {#writeLength: writeLength}),
returnValueForMissingStub: null,
);
@override
- void writeDoubleList(
- List<double>? list, {
- bool? writeLength = true,
- }) =>
+ void writeDoubleList(List<double>? list, {bool? writeLength = true}) =>
super.noSuchMethod(
Invocation.method(
#writeDoubleList,
@@ -389,16 +280,9 @@ class MockBinaryWriter extends _i2.Mock implements _i3.BinaryWriter {
);
@override
- void writeBoolList(
- List<bool>? list, {
- bool? writeLength = true,
- }) =>
+ void writeBoolList(List<bool>? list, {bool? writeLength = true}) =>
super.noSuchMethod(
- Invocation.method(
- #writeBoolList,
- [list],
- {#writeLength: writeLength},
- ),
+ Invocation.method(#writeBoolList, [list], {#writeLength: writeLength}),
returnValueForMissingStub: null,
);
@@ -407,44 +291,26 @@ class MockBinaryWriter extends _i2.Mock implements _i3.BinaryWriter {
List<String>? list, {
bool? writeLength = true,
_i5.Converter<String, List<int>>? encoder = const _i5.Utf8Encoder(),
- }) =>
- super.noSuchMethod(
- Invocation.method(
- #writeStringList,
- [list],
- {
- #writeLength: writeLength,
- #encoder: encoder,
- },
- ),
- returnValueForMissingStub: null,
- );
+ }) => super.noSuchMethod(
+ Invocation.method(
+ #writeStringList,
+ [list],
+ {#writeLength: writeLength, #encoder: encoder},
+ ),
+ returnValueForMissingStub: null,
+ );
@override
- void writeList(
- List<dynamic>? list, {
- bool? writeLength = true,
- }) =>
+ void writeList(List<dynamic>? list, {bool? writeLength = true}) =>
super.noSuchMethod(
- Invocation.method(
- #writeList,
- [list],
- {#writeLength: writeLength},
- ),
+ Invocation.method(#writeList, [list], {#writeLength: writeLength}),
returnValueForMissingStub: null,
);
@override
- void writeMap(
- Map<dynamic, dynamic>? map, {
- bool? writeLength = true,
- }) =>
+ void writeMap(Map<dynamic, dynamic>? map, {bool? writeLength = true}) =>
super.noSuchMethod(
- Invocation.method(
- #writeMap,
- [map],
- {#writeLength: writeLength},
- ),
+ Invocation.method(#writeMap, [map], {#writeLength: writeLength}),
returnValueForMissingStub: null,
);
@@ -452,27 +318,14 @@ class MockBinaryWriter extends _i2.Mock implements _i3.BinaryWriter {
void writeHiveList(
_i3.HiveList<_i1.HiveObjectMixin>? list, {
bool? writeLength = true,
- }) =>
- super.noSuchMethod(
- Invocation.method(
- #writeHiveList,
- [list],
- {#writeLength: writeLength},
- ),
- returnValueForMissingStub: null,
- );
+ }) => super.noSuchMethod(
+ Invocation.method(#writeHiveList, [list], {#writeLength: writeLength}),
+ returnValueForMissingStub: null,
+ );
@override
- void write<T>(
- T? value, {
- bool? writeTypeId = true,
- }) =>
- super.noSuchMethod(
- Invocation.method(
- #write,
- [value],
- {#writeTypeId: writeTypeId},
- ),
- returnValueForMissingStub: null,
- );
+ void write<T>(T? value, {bool? writeTypeId = true}) => super.noSuchMethod(
+ Invocation.method(#write, [value], {#writeTypeId: writeTypeId}),
+ returnValueForMissingStub: null,
+ );
}
diff --git a/test/price_test.dart b/test/price_test.dart
index e44e6b3..e7a8b40 100644
--- a/test/price_test.dart
+++ b/test/price_test.dart
@@ -4,7 +4,7 @@ import 'dart:convert';
import 'dart:io';
import 'package:flutter_test/flutter_test.dart';
-import 'package:hive/hive.dart';
+import 'package:hive_ce/hive.dart';
import 'package:hive_test/hive_test.dart';
import 'package:mockito/annotations.dart';
import 'package:mockito/mockito.dart';
@@ -21,85 +21,94 @@ void main() {
await Hive.openBox<dynamic>(DB.boxNamePriceCache);
await Hive.openBox<dynamic>(DB.boxNamePrefs);
await DB.instance.put<dynamic>(
- boxName: DB.boxNamePrefs, key: "externalCalls", value: true);
+ boxName: DB.boxNamePrefs,
+ key: "externalCalls",
+ value: true,
+ );
});
test("getPricesAnd24hChange fetch", () async {
final client = MockHTTP();
- when(client.get(
+ when(
+ client.get(
proxyInfo: null,
url: Uri.parse(
- "https://api.coingecko.com/api/v3/coins/markets?vs_currency=btc&ids"
- "=monero,bitcoin,litecoin,ecash,epic-cash,zcoin,dogecoin,bitcoin-cash"
- ",namecoin,wownero,ethereum,particl,nano,banano,stellar,tezos,xelis"
- "&order=market_cap_desc&per_page=50"
- "&page=1&sparkline=false"),
- headers: {
- 'Content-Type': 'application/json'
- })).thenAnswer((_) async => Response(
+ "https://api.coingecko.com/api/v3/coins/markets?vs_currency=btc&ids"
+ "=monero,bitcoin,litecoin,ecash,epic-cash,zcoin,dogecoin,bitcoin-cash"
+ ",namecoin,wownero,ethereum,particl,nano,banano,stellar,tezos,xelis"
+ "&order=market_cap_desc&per_page=50"
+ "&page=1&sparkline=false",
+ ),
+ headers: {'Content-Type': 'application/json'},
+ ),
+ ).thenAnswer(
+ (_) async => Response(
utf8.encode(
- '[{"id":"bitcoin","symbol":"btc","name":"Bitcoin","image":"https://asse'
- 'ts.coingecko.com/coins/images/1/large/bitcoin.png?1547033579","curr'
- 'ent_price":1.0,"market_cap":19128800,"market_cap_rank":1,"fully_dil'
- 'uted_valuation":21000000,"total_volume":1272132,"high_24h":1.0,"low'
- '_24h":1.0,"price_change_24h":0.0,"price_change_percentage_24h":0.0,'
- '"market_cap_change_24h":950.0,"market_cap_change_percentage_24h":0.0'
- '0497,"circulating_supply":19128800.0,"total_supply":21000000.0,"max'
- '_supply":21000000.0,"ath":1.003301,"ath_change_percentage":-0.32896'
- ',"ath_date":"2019-10-15T16:00:56.136Z","atl":0.99895134,"atl_change_'
- 'percentage":0.10498,"atl_date":"2019-10-21T00:00:00.000Z","roi":nul'
- 'l,"last_updated":"2022-08-22T16:37:59.237Z"},{"id":"dogecoin","symb'
- 'ol":"doge","name":"Dogecoin","image":"https://assets.coingecko.com/'
- 'coins/images/5/large/dogecoin.png?1547792256","current_price":3.15e'
- '-06,"market_cap":417916,"market_cap_rank":10,"fully_diluted_valuati'
- 'on":null,"total_volume":27498,"high_24h":3.26e-06,"low_24h":3.13e-0'
- '6,"price_change_24h":-8.6889947714e-08,"price_change_percentage_24h'
- '":-2.68533,"market_cap_change_24h":-11370.894861206936,"market_cap_c'
- 'hange_percentage_24h":-2.64879,"circulating_supply":132670764299.89'
- '4,"total_supply":null,"max_supply":null,"ath":1.264e-05,"ath_change'
- '_percentage":-75.05046,"ath_date":"2021-05-07T23:04:53.026Z","atl":'
- '1.50936e-07,"atl_change_percentage":1989.69346,"atl_date":"2020-12-'
- '17T09:18:05.654Z","roi":null,"last_updated":"2022-08-22T16:38:15.11'
- '3Z"},{"id":"monero","symbol":"xmr","name":"Monero","image":"https:/'
- '/assets.coingecko.com/coins/images/69/large/monero_logo.png?1547033'
- '729","current_price":0.00717236,"market_cap":130002,"market_cap_ran'
- 'k":29,"fully_diluted_valuation":null,"total_volume":4901,"high_24h":'
- '0.00731999,"low_24h":0.00707511,"price_change_24h":-5.6133543212467'
- 'e-05,"price_change_percentage_24h":-0.77656,"market_cap_change_24h"'
- ':-1007.8447677436197,"market_cap_change_percentage_24h":-0.76929,"c'
- 'irculating_supply":18147820.3764146,"total_supply":null,"max_supply'
- '":null,"ath":0.03475393,"ath_change_percentage":-79.32037,"ath_date'
- '":"2018-01-09T00:00:00.000Z","atl":0.00101492,"atl_change_percentag'
- 'e":608.13327,"atl_date":"2014-12-18T00:00:00.000Z","roi":null,"las'
- 't_updated":"2022-08-22T16:38:26.347Z"},{"id":"zcoin","symbol":"firo'
- '","name":"Firo","image":"https://assets.coingecko.com/coins/images/'
- '479/large/firocoingecko.png?1636537544","current_price":0.0001096,"'
- 'market_cap":1252,"market_cap_rank":604,"fully_diluted_valuation":234'
- '9,"total_volume":90.573,"high_24h":0.00011148,"low_24h":0.00010834,'
- '"price_change_24h":-9.87561775002e-07,"price_change_percentage_24h'
- '":-0.89304,"market_cap_change_24h":-10.046635178462793,"market_cap_'
- 'change_percentage_24h":-0.79578,"circulating_supply":11411043.83546'
- '97,"total_supply":21400000.0,"max_supply":21400000.0,"ath":0.016162'
- '72,"ath_change_percentage":-99.3208,"ath_date":"2018-04-04T16:04:48.'
- '408Z","atl":4.268e-05,"atl_change_percentage":157.22799,"atl_date":"'
- '2022-05-12T07:28:47.088Z","roi":null,"last_updated":"2022-08-22T16'
- ':38:47.229Z"},{"id":"epic-cash","symbol":"epic","name":"Epic Cash",'
- '"image":"https://assets.coingecko.com/coins/images/9520/large/Epic_C'
- 'oin_NO_drop_shadow.png?1620122642","current_price":2.803e-05,"marke'
- 't_cap":415.109,"market_cap_rank":953,"fully_diluted_valuation":null'
- ',"total_volume":0.2371557,"high_24h":3.053e-05,"low_24h":2.581e-05'
- ',"price_change_24h":1.9e-06,"price_change_percentage_24h":7.27524,"'
- 'market_cap_change_24h":28.26753,"market_cap_change_percentage_24h":'
- '7.30726,"circulating_supply":14808052.0,"total_supply":21000000.0,"'
- 'max_supply":null,"ath":0.00013848,"ath_change_percentage":-79.75864'
- ',"ath_date":"2021-12-11T08:39:41.129Z","atl":5.74028e-07,"atl_chang'
- 'e_percentage":4783.08078,"atl_date":"2020-03-13T16:55:01.177Z","roi'
- '":null,"last_updated":"2022-08-22T16:38:32.826Z"},{"id":"xelis","sy'
- 'mbol":"xel","name":"Xelis","image":"https://assets.coingecko.com/co'
- 'ins/images/37615/large/green_background_black_logo.png","current_pr'
- 'ice":0.00001234,"price_change_percentage_24h":5.67}]'),
- 200));
+ '[{"id":"bitcoin","symbol":"btc","name":"Bitcoin","image":"https://asse'
+ 'ts.coingecko.com/coins/images/1/large/bitcoin.png?1547033579","curr'
+ 'ent_price":1.0,"market_cap":19128800,"market_cap_rank":1,"fully_dil'
+ 'uted_valuation":21000000,"total_volume":1272132,"high_24h":1.0,"low'
+ '_24h":1.0,"price_change_24h":0.0,"price_change_percentage_24h":0.0,'
+ '"market_cap_change_24h":950.0,"market_cap_change_percentage_24h":0.0'
+ '0497,"circulating_supply":19128800.0,"total_supply":21000000.0,"max'
+ '_supply":21000000.0,"ath":1.003301,"ath_change_percentage":-0.32896'
+ ',"ath_date":"2019-10-15T16:00:56.136Z","atl":0.99895134,"atl_change_'
+ 'percentage":0.10498,"atl_date":"2019-10-21T00:00:00.000Z","roi":nul'
+ 'l,"last_updated":"2022-08-22T16:37:59.237Z"},{"id":"dogecoin","symb'
+ 'ol":"doge","name":"Dogecoin","image":"https://assets.coingecko.com/'
+ 'coins/images/5/large/dogecoin.png?1547792256","current_price":3.15e'
+ '-06,"market_cap":417916,"market_cap_rank":10,"fully_diluted_valuati'
+ 'on":null,"total_volume":27498,"high_24h":3.26e-06,"low_24h":3.13e-0'
+ '6,"price_change_24h":-8.6889947714e-08,"price_change_percentage_24h'
+ '":-2.68533,"market_cap_change_24h":-11370.894861206936,"market_cap_c'
+ 'hange_percentage_24h":-2.64879,"circulating_supply":132670764299.89'
+ '4,"total_supply":null,"max_supply":null,"ath":1.264e-05,"ath_change'
+ '_percentage":-75.05046,"ath_date":"2021-05-07T23:04:53.026Z","atl":'
+ '1.50936e-07,"atl_change_percentage":1989.69346,"atl_date":"2020-12-'
+ '17T09:18:05.654Z","roi":null,"last_updated":"2022-08-22T16:38:15.11'
+ '3Z"},{"id":"monero","symbol":"xmr","name":"Monero","image":"https:/'
+ '/assets.coingecko.com/coins/images/69/large/monero_logo.png?1547033'
+ '729","current_price":0.00717236,"market_cap":130002,"market_cap_ran'
+ 'k":29,"fully_diluted_valuation":null,"total_volume":4901,"high_24h":'
+ '0.00731999,"low_24h":0.00707511,"price_change_24h":-5.6133543212467'
+ 'e-05,"price_change_percentage_24h":-0.77656,"market_cap_change_24h"'
+ ':-1007.8447677436197,"market_cap_change_percentage_24h":-0.76929,"c'
+ 'irculating_supply":18147820.3764146,"total_supply":null,"max_supply'
+ '":null,"ath":0.03475393,"ath_change_percentage":-79.32037,"ath_date'
+ '":"2018-01-09T00:00:00.000Z","atl":0.00101492,"atl_change_percentag'
+ 'e":608.13327,"atl_date":"2014-12-18T00:00:00.000Z","roi":null,"las'
+ 't_updated":"2022-08-22T16:38:26.347Z"},{"id":"zcoin","symbol":"firo'
+ '","name":"Firo","image":"https://assets.coingecko.com/coins/images/'
+ '479/large/firocoingecko.png?1636537544","current_price":0.0001096,"'
+ 'market_cap":1252,"market_cap_rank":604,"fully_diluted_valuation":234'
+ '9,"total_volume":90.573,"high_24h":0.00011148,"low_24h":0.00010834,'
+ '"price_change_24h":-9.87561775002e-07,"price_change_percentage_24h'
+ '":-0.89304,"market_cap_change_24h":-10.046635178462793,"market_cap_'
+ 'change_percentage_24h":-0.79578,"circulating_supply":11411043.83546'
+ '97,"total_supply":21400000.0,"max_supply":21400000.0,"ath":0.016162'
+ '72,"ath_change_percentage":-99.3208,"ath_date":"2018-04-04T16:04:48.'
+ '408Z","atl":4.268e-05,"atl_change_percentage":157.22799,"atl_date":"'
+ '2022-05-12T07:28:47.088Z","roi":null,"last_updated":"2022-08-22T16'
+ ':38:47.229Z"},{"id":"epic-cash","symbol":"epic","name":"Epic Cash",'
+ '"image":"https://assets.coingecko.com/coins/images/9520/large/Epic_C'
+ 'oin_NO_drop_shadow.png?1620122642","current_price":2.803e-05,"marke'
+ 't_cap":415.109,"market_cap_rank":953,"fully_diluted_valuation":null'
+ ',"total_volume":0.2371557,"high_24h":3.053e-05,"low_24h":2.581e-05'
+ ',"price_change_24h":1.9e-06,"price_change_percentage_24h":7.27524,"'
+ 'market_cap_change_24h":28.26753,"market_cap_change_percentage_24h":'
+ '7.30726,"circulating_supply":14808052.0,"total_supply":21000000.0,"'
+ 'max_supply":null,"ath":0.00013848,"ath_change_percentage":-79.75864'
+ ',"ath_date":"2021-12-11T08:39:41.129Z","atl":5.74028e-07,"atl_chang'
+ 'e_percentage":4783.08078,"atl_date":"2020-03-13T16:55:01.177Z","roi'
+ '":null,"last_updated":"2022-08-22T16:38:32.826Z"},{"id":"xelis","sy'
+ 'mbol":"xel","name":"Xelis","image":"https://assets.coingecko.com/co'
+ 'ins/images/37615/large/green_background_black_logo.png","current_pr'
+ 'ice":0.00001234,"price_change_percentage_24h":5.67}]',
+ ),
+ 200,
+ ),
+ );
final priceAPI = PriceAPI(client);
priceAPI.resetLastCalledToForceNextCallToUpdateCache();
@@ -134,7 +143,8 @@ void main() {
'Coin.xelis: [0.00001234, 5.67]'
'}',
);
- verify(client.get(
+ verify(
+ client.get(
proxyInfo: null,
url: Uri.parse(
"https://api.coingecko.com/api/v3/coins/markets?vs_currency=btc"
@@ -143,7 +153,9 @@ void main() {
",tezos,xelis"
"&order=market_cap_desc&per_page=50&page=1&sparkline=false",
),
- headers: {'Content-Type': 'application/json'})).called(1);
+ headers: {'Content-Type': 'application/json'},
+ ),
+ ).called(1);
verifyNoMoreInteractions(client);
});
@@ -151,79 +163,85 @@ void main() {
test("cached price fetch", () async {
final client = MockHTTP();
- when(client.get(
+ when(
+ client.get(
proxyInfo: null,
url: Uri.parse(
- "https://api.coingecko.com/api/v3/coins/markets?vs_currency=btc&"
- "ids=monero,bitcoin,litecoin,ecash,epic-cash,zcoin,dogecoin,"
- "bitcoin-cash,namecoin,wownero,ethereum,particl,nano,banano,stellar"
- ",tezos,xelis"
- "&order=market_cap_desc&per_page=50&page=1&sparkline=false"),
- headers: {
- 'Content-Type': 'application/json'
- })).thenAnswer((_) async => Response(
+ "https://api.coingecko.com/api/v3/coins/markets?vs_currency=btc&"
+ "ids=monero,bitcoin,litecoin,ecash,epic-cash,zcoin,dogecoin,"
+ "bitcoin-cash,namecoin,wownero,ethereum,particl,nano,banano,stellar"
+ ",tezos,xelis"
+ "&order=market_cap_desc&per_page=50&page=1&sparkline=false",
+ ),
+ headers: {'Content-Type': 'application/json'},
+ ),
+ ).thenAnswer(
+ (_) async => Response(
utf8.encode(
- '[{"id":"bitcoin","symbol":"btc","name":"Bitcoin","image":"https://a'
- 'ssets.coingecko.com/coins/images/1/large/bitcoin.png?1547033579","c'
- 'urrent_price":1.0,"market_cap":19128800,"market_cap_rank":1,"fully_'
- 'diluted_valuation":21000000,"total_volume":1272132,"high_24h":1.0,"'
- 'low_24h":1.0,"price_change_24h":0.0,"price_change_percentage_24h":0'
- '.0,"market_cap_change_24h":950.0,"market_cap_change_percentage_24h"'
- ':0.00497,"circulating_supply":19128800.0,"total_supply":21000000.0,"'
- 'max_supply":21000000.0,"ath":1.003301,"ath_change_percentage":-0.32'
- '896,"ath_date":"2019-10-15T16:00:56.136Z","atl":0.99895134,"atl_cha'
- 'nge_percentage":0.10498,"atl_date":"2019-10-21T00:00:00.000Z","roi"'
- ':null,"last_updated":"2022-08-22T16:37:59.237Z"},{"id":"dogecoin","'
- 'symbol":"doge","name":"Dogecoin","image":"https://assets.coingecko.'
- 'com/coins/images/5/large/dogecoin.png?1547792256","current_price":3'
- '.15e-06,"market_cap":417916,"market_cap_rank":10,"fully_diluted_val'
- 'uation":null,"total_volume":27498,"high_24h":3.26e-06,"low_24h":3.1'
- '3e-06,"price_change_24h":-8.6889947714e-08,"price_change_percentage'
- '_24h":-2.68533,"market_cap_change_24h":-11370.894861206936,"market_'
- 'cap_change_percentage_24h":-2.64879,"circulating_supply":1326707642'
- '99.894,"total_supply":null,"max_supply":null,"ath":1.264e-05,"ath_c'
- 'hange_percentage":-75.05046,"ath_date":"2021-05-07T23:04:53.026Z","'
- 'atl":1.50936e-07,"atl_change_percentage":1989.69346,"atl_date":"202'
- '0-12-17T09:18:05.654Z","roi":null,"last_updated":"2022-08-22T16:38:'
- '15.113Z"},{"id":"monero","symbol":"xmr","name":"Monero","image":"ht'
- 'tps://assets.coingecko.com/coins/images/69/large/monero_logo.png?15'
- '47033729","current_price":0.00717236,"market_cap":130002,"market_cap'
- '_rank":29,"fully_diluted_valuation":null,"total_volume":4901,"high'
- '_24h":0.00731999,"low_24h":0.00707511,"price_change_24h":-5.613354'
- '3212467e-05,"price_change_percentage_24h":-0.77656,"market_cap_chan'
- 'ge_24h":-1007.8447677436197,"market_cap_change_percentage_24h":-0.7'
- '6929,"circulating_supply":18147820.3764146,"total_supply":null,"ma'
- 'x_supply":null,"ath":0.03475393,"ath_change_percentage":-79.32037,"'
- 'ath_date":"2018-01-09T00:00:00.000Z","atl":0.00101492,"atl_change_'
- 'percentage":608.13327,"atl_date":"2014-12-18T00:00:00.000Z","roi":n'
- 'ull,"last_updated":"2022-08-22T16:38:26.347Z"},{"id":"zcoin","symbo'
- 'l":"firo","name":"Firo","image":"https://assets.coingecko.com/coins'
- '/images/479/large/firocoingecko.png?1636537544","current_price":0.0'
- '001096,"market_cap":1252,"market_cap_rank":604,"fully_diluted_valu'
- 'ation":2349,"total_volume":90.573,"high_24h":0.00011148,"low_24h":0'
- '.00010834,"price_change_24h":-9.87561775002e-07,"price_change_perce'
- 'ntage_24h":-0.89304,"market_cap_change_24h":-10.046635178462793,"ma'
- 'rket_cap_change_percentage_24h":-0.79578,"circulating_supply":11411'
- '043.8354697,"total_supply":21400000.0,"max_supply":21400000.0,"ath"'
- ':0.01616272,"ath_change_percentage":-99.3208,"ath_date":"2018-04-04'
- 'T16:04:48.408Z","atl":4.268e-05,"atl_change_percentage":157.22799,'
- '"atl_date":"2022-05-12T07:28:47.088Z","roi":null,"last_updated":"2'
- '022-08-22T16:38:47.229Z"},{"id":"epic-cash","symbol":"epic","name":"'
- 'Epic Cash","image":"https://assets.coingecko.com/coins/images/9520/'
- 'large/Epic_Coin_NO_drop_shadow.png?1620122642","current_price":2.80'
- '3e-05,"market_cap":415.109,"market_cap_rank":953,"fully_diluted_val'
- 'uation":null,"total_volume":0.2371557,"high_24h":3.053e-05,"low_24h'
- '":2.581e-05,"price_change_24h":1.9e-06,"price_change_percentage_24'
- 'h":7.27524,"market_cap_change_24h":28.26753,"market_cap_change_perc'
- 'entage_24h":7.30726,"circulating_supply":14808052.0,"total_supply":'
- '21000000.0,"max_supply":null,"ath":0.00013848,"ath_change_percentag'
- 'e":-79.75864,"ath_date":"2021-12-11T08:39:41.129Z","atl":5.74028e-0'
- '7,"atl_change_percentage":4783.08078,"atl_date":"2020-03-13T16:55:01'
- '.177Z","roi":null,"last_updated":"2022-08-22T16:38:32.826Z"},{"id":'
- '"xelis","symbol":"xel","name":"Xelis","image":"https://assets.coing'
- 'ecko.com/coins/images/37615/large/green_background_black_logo.png",'
- '"current_price":0.00001234,"price_change_percentage_24h":5.67}]'),
- 200));
+ '[{"id":"bitcoin","symbol":"btc","name":"Bitcoin","image":"https://a'
+ 'ssets.coingecko.com/coins/images/1/large/bitcoin.png?1547033579","c'
+ 'urrent_price":1.0,"market_cap":19128800,"market_cap_rank":1,"fully_'
+ 'diluted_valuation":21000000,"total_volume":1272132,"high_24h":1.0,"'
+ 'low_24h":1.0,"price_change_24h":0.0,"price_change_percentage_24h":0'
+ '.0,"market_cap_change_24h":950.0,"market_cap_change_percentage_24h"'
+ ':0.00497,"circulating_supply":19128800.0,"total_supply":21000000.0,"'
+ 'max_supply":21000000.0,"ath":1.003301,"ath_change_percentage":-0.32'
+ '896,"ath_date":"2019-10-15T16:00:56.136Z","atl":0.99895134,"atl_cha'
+ 'nge_percentage":0.10498,"atl_date":"2019-10-21T00:00:00.000Z","roi"'
+ ':null,"last_updated":"2022-08-22T16:37:59.237Z"},{"id":"dogecoin","'
+ 'symbol":"doge","name":"Dogecoin","image":"https://assets.coingecko.'
+ 'com/coins/images/5/large/dogecoin.png?1547792256","current_price":3'
+ '.15e-06,"market_cap":417916,"market_cap_rank":10,"fully_diluted_val'
+ 'uation":null,"total_volume":27498,"high_24h":3.26e-06,"low_24h":3.1'
+ '3e-06,"price_change_24h":-8.6889947714e-08,"price_change_percentage'
+ '_24h":-2.68533,"market_cap_change_24h":-11370.894861206936,"market_'
+ 'cap_change_percentage_24h":-2.64879,"circulating_supply":1326707642'
+ '99.894,"total_supply":null,"max_supply":null,"ath":1.264e-05,"ath_c'
+ 'hange_percentage":-75.05046,"ath_date":"2021-05-07T23:04:53.026Z","'
+ 'atl":1.50936e-07,"atl_change_percentage":1989.69346,"atl_date":"202'
+ '0-12-17T09:18:05.654Z","roi":null,"last_updated":"2022-08-22T16:38:'
+ '15.113Z"},{"id":"monero","symbol":"xmr","name":"Monero","image":"ht'
+ 'tps://assets.coingecko.com/coins/images/69/large/monero_logo.png?15'
+ '47033729","current_price":0.00717236,"market_cap":130002,"market_cap'
+ '_rank":29,"fully_diluted_valuation":null,"total_volume":4901,"high'
+ '_24h":0.00731999,"low_24h":0.00707511,"price_change_24h":-5.613354'
+ '3212467e-05,"price_change_percentage_24h":-0.77656,"market_cap_chan'
+ 'ge_24h":-1007.8447677436197,"market_cap_change_percentage_24h":-0.7'
+ '6929,"circulating_supply":18147820.3764146,"total_supply":null,"ma'
+ 'x_supply":null,"ath":0.03475393,"ath_change_percentage":-79.32037,"'
+ 'ath_date":"2018-01-09T00:00:00.000Z","atl":0.00101492,"atl_change_'
+ 'percentage":608.13327,"atl_date":"2014-12-18T00:00:00.000Z","roi":n'
+ 'ull,"last_updated":"2022-08-22T16:38:26.347Z"},{"id":"zcoin","symbo'
+ 'l":"firo","name":"Firo","image":"https://assets.coingecko.com/coins'
+ '/images/479/large/firocoingecko.png?1636537544","current_price":0.0'
+ '001096,"market_cap":1252,"market_cap_rank":604,"fully_diluted_valu'
+ 'ation":2349,"total_volume":90.573,"high_24h":0.00011148,"low_24h":0'
+ '.00010834,"price_change_24h":-9.87561775002e-07,"price_change_perce'
+ 'ntage_24h":-0.89304,"market_cap_change_24h":-10.046635178462793,"ma'
+ 'rket_cap_change_percentage_24h":-0.79578,"circulating_supply":11411'
+ '043.8354697,"total_supply":21400000.0,"max_supply":21400000.0,"ath"'
+ ':0.01616272,"ath_change_percentage":-99.3208,"ath_date":"2018-04-04'
+ 'T16:04:48.408Z","atl":4.268e-05,"atl_change_percentage":157.22799,'
+ '"atl_date":"2022-05-12T07:28:47.088Z","roi":null,"last_updated":"2'
+ '022-08-22T16:38:47.229Z"},{"id":"epic-cash","symbol":"epic","name":"'
+ 'Epic Cash","image":"https://assets.coingecko.com/coins/images/9520/'
+ 'large/Epic_Coin_NO_drop_shadow.png?1620122642","current_price":2.80'
+ '3e-05,"market_cap":415.109,"market_cap_rank":953,"fully_diluted_val'
+ 'uation":null,"total_volume":0.2371557,"high_24h":3.053e-05,"low_24h'
+ '":2.581e-05,"price_change_24h":1.9e-06,"price_change_percentage_24'
+ 'h":7.27524,"market_cap_change_24h":28.26753,"market_cap_change_perc'
+ 'entage_24h":7.30726,"circulating_supply":14808052.0,"total_supply":'
+ '21000000.0,"max_supply":null,"ath":0.00013848,"ath_change_percentag'
+ 'e":-79.75864,"ath_date":"2021-12-11T08:39:41.129Z","atl":5.74028e-0'
+ '7,"atl_change_percentage":4783.08078,"atl_date":"2020-03-13T16:55:01'
+ '.177Z","roi":null,"last_updated":"2022-08-22T16:38:32.826Z"},{"id":'
+ '"xelis","symbol":"xel","name":"Xelis","image":"https://assets.coing'
+ 'ecko.com/coins/images/37615/large/green_background_black_logo.png",'
+ '"current_price":0.00001234,"price_change_percentage_24h":5.67}]',
+ ),
+ 200,
+ ),
+ );
final priceAPI = PriceAPI(client);
priceAPI.resetLastCalledToForceNextCallToUpdateCache();
@@ -232,8 +250,9 @@ void main() {
await priceAPI.getPricesAnd24hChange(baseCurrency: "btc");
// now this time it should grab from cache instead of http.get
- final cachedPrice =
- await priceAPI.getPricesAnd24hChange(baseCurrency: "btc");
+ final cachedPrice = await priceAPI.getPricesAnd24hChange(
+ baseCurrency: "btc",
+ );
expect(
cachedPrice.toString(),
@@ -262,15 +281,19 @@ void main() {
);
// verify only called once during filling of cache
- verify(client.get(
+ verify(
+ client.get(
proxyInfo: null,
url: Uri.parse(
- "https://api.coingecko.com/api/v3/coins/markets?vs_currency=btc&ids"
- "=monero,bitcoin,litecoin,ecash,epic-cash,zcoin,dogecoin,"
- "bitcoin-cash,namecoin,wownero,ethereum,particl,nano,banano,stellar"
- ",tezos,xelis"
- "&order=market_cap_desc&per_page=50&page=1&sparkline=false"),
- headers: {'Content-Type': 'application/json'})).called(1);
+ "https://api.coingecko.com/api/v3/coins/markets?vs_currency=btc&ids"
+ "=monero,bitcoin,litecoin,ecash,epic-cash,zcoin,dogecoin,"
+ "bitcoin-cash,namecoin,wownero,ethereum,particl,nano,banano,stellar"
+ ",tezos,xelis"
+ "&order=market_cap_desc&per_page=50&page=1&sparkline=false",
+ ),
+ headers: {'Content-Type': 'application/json'},
+ ),
+ ).called(1);
verifyNoMoreInteractions(client);
});
@@ -278,79 +301,85 @@ void main() {
test("response parse failure", () async {
final client = MockHTTP();
- when(client.get(
+ when(
+ client.get(
proxyInfo: null,
url: Uri.parse(
- "https://api.coingecko.com/api/v3/coins/markets?vs_currency=btc"
- "&ids=monero,bitcoin,litecoin,ecash,epic-cash,zcoin,dogecoin,"
- "bitcoin-cash,namecoin,wownero,ethereum,particl,nano,banano,stellar"
- ",tezos,xelis"
- "&order=market_cap_desc&per_page=50&page=1&sparkline=false"),
- headers: {
- 'Content-Type': 'application/json'
- })).thenAnswer((_) async => Response(
+ "https://api.coingecko.com/api/v3/coins/markets?vs_currency=btc"
+ "&ids=monero,bitcoin,litecoin,ecash,epic-cash,zcoin,dogecoin,"
+ "bitcoin-cash,namecoin,wownero,ethereum,particl,nano,banano,stellar"
+ ",tezos,xelis"
+ "&order=market_cap_desc&per_page=50&page=1&sparkline=false",
+ ),
+ headers: {'Content-Type': 'application/json'},
+ ),
+ ).thenAnswer(
+ (_) async => Response(
utf8.encode(
- '[{"id":"bitcoin","symbol":"btc","name":com/coins/images/1/large/'
- 'bitcoin.png?1547033579","current_price":1.0,"market_cap":19128800'
- ',"market_cap_rank":1,"fully_diluted_valuation":21000000,"total_volum'
- 'e":1272132,"high_24h":1.0,"low_24h":1.0,"price_change_24h":0.0,"pri'
- 'ce_change_percentage_24h":0.0,"market_cap_change_24h":950.0,"market_'
- 'cap_change_percentage_24h":0.00497,"circulating_supply":19128800.0,"t'
- 'otal_supply":21000000.0,"max_supply":21000000.0,"ath":1.003301,"ath'
- '_change_percentage":-0.32896,"ath_date":"2019-10-15T16:00:56.136Z",'
- '"atl":0.99895134,"atl_change_percentage":0.10498,"atl_date":'
- '"2019-10-21T00:00:00.000Z","roi":null,'
- '"last_updated":"2022-08-22T16:37:59.237Z"},{"id":"dogecoin"'
- ',"symbol":"doge","name":"Dogecoin","image":'
- '"https://assets.coingecko.com/coins/images/5/large/dogecoin.png?1547792256",'
- '"current_price":3.15e-06,"market_cap":417916,"market_cap_rank":10'
- ',"fully_diluted_valuation":null,"total_volume":27498,"high_24h":3'
- '.26e-06,"low_24h":3.13e-06,"price_change_24h":-8.6889947714e-08,"'
- 'price_change_percentage_24h":-2.68533,"market_cap_change_24h":-11'
- '370.894861206936,"market_cap_change_percentage_24h":-2.64879,"cir'
- 'culating_supply":132670764299.894,"total_supply":null,"max_supply'
- '":null,"ath":1.264e-05,"ath_change_percentage":-75.05046,"ath_date'
- '":"2021-05-07T23:04:53.026Z","atl":1.50936e-07,"atl_change_percen'
- 'tage":1989.69346,"atl_date":"2020-12-17T09:18:05.654Z","roi":null,'
- '"last_updated":"2022-08-22T16:38:15.113Z"},{"id":"monero","symbol"'
- ':"xmr","name":"Monero","image":"https://assets.coingecko.com/coins'
- '/images/69/large/monero_logo.png?1547033729","current_price":0.007'
- '17236,"market_cap":130002,"market_cap_rank":29,"fully_diluted_valu'
- 'ation":null,"total_volume":4901,"high_24h":0.00731999,"low_24h":0.'
- '00707511,"price_change_24h":-5.6133543212467e-05,"price_change_per'
- 'centage_24h":-0.77656,"market_cap_change_24h":-1007.8447677436197'
- ',"market_cap_change_percentage_24h":-0.76929,"circulating_supply":'
- '18147820.3764146,"total_supply":null,"max_supply":null,"ath":0.034'
- '75393,"ath_change_percentage":-79.32037,"ath_date":"2018-01-09T00:'
- '00:00.000Z","atl":0.00101492,"atl_change_percentage":608.13327,"at'
- 'l_date":"2014-12-18T00:00:00.000Z","roi":null,"last_updated":"2022'
- '-08-22T16:38:26.347Z"},{"id":"zcoin","symbol":"firo","name":"Firo"'
- ',"image":"https://assets.coingecko.com/coins/images/479/large/firo'
- 'coingecko.png?1636537544","current_price":0.0001096,"market_cap":1'
- '252,"market_cap_rank":604,"fully_diluted_valuation":2349,"total_vo'
- 'lume":90.573,"high_24h":0.00011148,"low_24h":0.00010834,"price_chang'
- 'e_24h":-9.87561775002e-07,"price_change_percentage_24h":-0.89304,'
- '"market_cap_change_24h":-10.046635178462793,"market_cap_change_per'
- 'centage_24h":-0.79578,"circulating_supply":11411043.8354697,"tota'
- 'l_supply":21400000.0,"max_supply":21400000.0,"ath":0.01616272,"ath'
- '_change_percentage":-99.3208,"ath_date":"2018-04-04T16:04:48.408Z"'
- ',"atl":4.268e-05,"atl_change_percentage":157.22799,"atl_date":"202'
- '2-05-12T07:28:47.088Z","roi":null,"last_updated":"2022-08-22T16:3'
- '8:47.229Z"},{"id":"epic-cash","symbol":"epic","name":"Epic Cash",'
- '"image":"https://assets.coingecko.com/coins/images/9520/large/'
- 'Epic_Coin_NO_drop_shadow.png?1620122642","current_price":2.803e-0'
- '5,"market_cap":415.109,"market_cap_rank":953,"fully_diluted_valuat'
- 'ion":null,"total_volume":0.2371557,"high_24h":3.053e-05,"low_24h":'
- '2.581e-05,"price_change_24h":1.9e-06,"price_change_percentage_24h"'
- ':7.27524,"market_cap_change_24h":28.26753,"market_cap_change_per'
- 'centage_24h":7.30726,"circulating_supply":14808052.0,"total_suppl'
- 'y":21000000.0,"max_supply":null,"ath":0.00013848,"ath_change_perce'
- 'ntage":-79.75864,"ath_date":"2021-12-11T08:39:41.129Z","atl":5.74'
- '028e-07,"atl_change_percentage":4783.08078,"atl_date":"2020-03-13T'
- '16:55:01.177Z","roi":null,"last_updated":"2022-08-22T16:38:32.826Z"'
- '},{"id":"xelis","symbol":xel,"name":com/coins/images/37615/large/g'
- 'reen_background_black_logo.png,"image":"https://assets.coingecko'),
- 200));
+ '[{"id":"bitcoin","symbol":"btc","name":com/coins/images/1/large/'
+ 'bitcoin.png?1547033579","current_price":1.0,"market_cap":19128800'
+ ',"market_cap_rank":1,"fully_diluted_valuation":21000000,"total_volum'
+ 'e":1272132,"high_24h":1.0,"low_24h":1.0,"price_change_24h":0.0,"pri'
+ 'ce_change_percentage_24h":0.0,"market_cap_change_24h":950.0,"market_'
+ 'cap_change_percentage_24h":0.00497,"circulating_supply":19128800.0,"t'
+ 'otal_supply":21000000.0,"max_supply":21000000.0,"ath":1.003301,"ath'
+ '_change_percentage":-0.32896,"ath_date":"2019-10-15T16:00:56.136Z",'
+ '"atl":0.99895134,"atl_change_percentage":0.10498,"atl_date":'
+ '"2019-10-21T00:00:00.000Z","roi":null,'
+ '"last_updated":"2022-08-22T16:37:59.237Z"},{"id":"dogecoin"'
+ ',"symbol":"doge","name":"Dogecoin","image":'
+ '"https://assets.coingecko.com/coins/images/5/large/dogecoin.png?1547792256",'
+ '"current_price":3.15e-06,"market_cap":417916,"market_cap_rank":10'
+ ',"fully_diluted_valuation":null,"total_volume":27498,"high_24h":3'
+ '.26e-06,"low_24h":3.13e-06,"price_change_24h":-8.6889947714e-08,"'
+ 'price_change_percentage_24h":-2.68533,"market_cap_change_24h":-11'
+ '370.894861206936,"market_cap_change_percentage_24h":-2.64879,"cir'
+ 'culating_supply":132670764299.894,"total_supply":null,"max_supply'
+ '":null,"ath":1.264e-05,"ath_change_percentage":-75.05046,"ath_date'
+ '":"2021-05-07T23:04:53.026Z","atl":1.50936e-07,"atl_change_percen'
+ 'tage":1989.69346,"atl_date":"2020-12-17T09:18:05.654Z","roi":null,'
+ '"last_updated":"2022-08-22T16:38:15.113Z"},{"id":"monero","symbol"'
+ ':"xmr","name":"Monero","image":"https://assets.coingecko.com/coins'
+ '/images/69/large/monero_logo.png?1547033729","current_price":0.007'
+ '17236,"market_cap":130002,"market_cap_rank":29,"fully_diluted_valu'
+ 'ation":null,"total_volume":4901,"high_24h":0.00731999,"low_24h":0.'
+ '00707511,"price_change_24h":-5.6133543212467e-05,"price_change_per'
+ 'centage_24h":-0.77656,"market_cap_change_24h":-1007.8447677436197'
+ ',"market_cap_change_percentage_24h":-0.76929,"circulating_supply":'
+ '18147820.3764146,"total_supply":null,"max_supply":null,"ath":0.034'
+ '75393,"ath_change_percentage":-79.32037,"ath_date":"2018-01-09T00:'
+ '00:00.000Z","atl":0.00101492,"atl_change_percentage":608.13327,"at'
+ 'l_date":"2014-12-18T00:00:00.000Z","roi":null,"last_updated":"2022'
+ '-08-22T16:38:26.347Z"},{"id":"zcoin","symbol":"firo","name":"Firo"'
+ ',"image":"https://assets.coingecko.com/coins/images/479/large/firo'
+ 'coingecko.png?1636537544","current_price":0.0001096,"market_cap":1'
+ '252,"market_cap_rank":604,"fully_diluted_valuation":2349,"total_vo'
+ 'lume":90.573,"high_24h":0.00011148,"low_24h":0.00010834,"price_chang'
+ 'e_24h":-9.87561775002e-07,"price_change_percentage_24h":-0.89304,'
+ '"market_cap_change_24h":-10.046635178462793,"market_cap_change_per'
+ 'centage_24h":-0.79578,"circulating_supply":11411043.8354697,"tota'
+ 'l_supply":21400000.0,"max_supply":21400000.0,"ath":0.01616272,"ath'
+ '_change_percentage":-99.3208,"ath_date":"2018-04-04T16:04:48.408Z"'
+ ',"atl":4.268e-05,"atl_change_percentage":157.22799,"atl_date":"202'
+ '2-05-12T07:28:47.088Z","roi":null,"last_updated":"2022-08-22T16:3'
+ '8:47.229Z"},{"id":"epic-cash","symbol":"epic","name":"Epic Cash",'
+ '"image":"https://assets.coingecko.com/coins/images/9520/large/'
+ 'Epic_Coin_NO_drop_shadow.png?1620122642","current_price":2.803e-0'
+ '5,"market_cap":415.109,"market_cap_rank":953,"fully_diluted_valuat'
+ 'ion":null,"total_volume":0.2371557,"high_24h":3.053e-05,"low_24h":'
+ '2.581e-05,"price_change_24h":1.9e-06,"price_change_percentage_24h"'
+ ':7.27524,"market_cap_change_24h":28.26753,"market_cap_change_per'
+ 'centage_24h":7.30726,"circulating_supply":14808052.0,"total_suppl'
+ 'y":21000000.0,"max_supply":null,"ath":0.00013848,"ath_change_perce'
+ 'ntage":-79.75864,"ath_date":"2021-12-11T08:39:41.129Z","atl":5.74'
+ '028e-07,"atl_change_percentage":4783.08078,"atl_date":"2020-03-13T'
+ '16:55:01.177Z","roi":null,"last_updated":"2022-08-22T16:38:32.826Z"'
+ '},{"id":"xelis","symbol":xel,"name":com/coins/images/37615/large/g'
+ 'reen_background_black_logo.png,"image":"https://assets.coingecko',
+ ),
+ 200,
+ ),
+ );
final priceAPI = PriceAPI(client);
priceAPI.resetLastCalledToForceNextCallToUpdateCache();
@@ -389,18 +418,23 @@ void main() {
test("no internet available", () async {
final client = MockHTTP();
- when(client.get(
+ when(
+ client.get(
proxyInfo: null,
url: Uri.parse(
- "https://api.coingecko.com/api/v3/coins/markets?vs_currency=btc"
- "&ids=monero,bitcoin,litecoin,ecash,epic-cash,zcoin,dogecoin,"
- "bitcoin-cash,namecoin,wownero,ethereum,particl,nano,banano,stellar"
- ",tezos,xelis"
- "&order=market_cap_desc&per_page=50&page=1&sparkline=false"),
- headers: {
- 'Content-Type': 'application/json'
- })).thenThrow(const SocketException(
- "Failed host lookup: 'api.com' (OS Error: Temporary failure in name resolution, errno = -3)"));
+ "https://api.coingecko.com/api/v3/coins/markets?vs_currency=btc"
+ "&ids=monero,bitcoin,litecoin,ecash,epic-cash,zcoin,dogecoin,"
+ "bitcoin-cash,namecoin,wownero,ethereum,particl,nano,banano,stellar"
+ ",tezos,xelis"
+ "&order=market_cap_desc&per_page=50&page=1&sparkline=false",
+ ),
+ headers: {'Content-Type': 'application/json'},
+ ),
+ ).thenThrow(
+ const SocketException(
+ "Failed host lookup: 'api.com' (OS Error: Temporary failure in name resolution, errno = -3)",
+ ),
+ );
final priceAPI = PriceAPI(client);
priceAPI.resetLastCalledToForceNextCallToUpdateCache();
diff --git a/test/services/coins/firo/firo_wallet_test.dart b/test/services/coins/firo/firo_wallet_test.dart
index ec2f5bd..3edbd52 100644
--- a/test/services/coins/firo/firo_wallet_test.dart
+++ b/test/services/coins/firo/firo_wallet_test.dart
@@ -1,5 +1,5 @@
import 'package:flutter_test/flutter_test.dart';
-import 'package:hive/hive.dart';
+import 'package:hive_ce/hive.dart';
import 'package:hive_test/hive_test.dart';
import 'package:mockito/annotations.dart';
diff --git a/test/services/coins/monero/monero_wallet_test.dart b/test/services/coins/monero/monero_wallet_test.dart
index d33c1b4..400c35a 100644
--- a/test/services/coins/monero/monero_wallet_test.dart
+++ b/test/services/coins/monero/monero_wallet_test.dart
@@ -17,7 +17,7 @@ import 'dart:core';
// import 'package:flutter_libmonero/core/wallet_creation_service.dart';
// import 'package:flutter_libmonero/monero/monero.dart';
// import 'package:flutter_test/flutter_test.dart';
-// import 'package:hive/hive.dart';
+// import 'package:hive_ce/hive.dart';
// import 'package:hive_test/hive_test.dart';
// import 'package:path_provider/path_provider.dart';
// import 'package:stackwallet/services/wallets.dart';
diff --git a/test/services/coins/wownero/wownero_wallet_test.dart b/test/services/coins/wownero/wownero_wallet_test.dart
index a14fbf3..ca9b978 100644
--- a/test/services/coins/wownero/wownero_wallet_test.dart
+++ b/test/services/coins/wownero/wownero_wallet_test.dart
@@ -17,7 +17,7 @@ import 'dart:core';
// import 'package:flutter_libmonero/core/wallet_creation_service.dart';
// import 'package:flutter_libmonero/wownero/wownero.dart';
// import 'package:flutter_test/flutter_test.dart';
-// import 'package:hive/hive.dart';
+// import 'package:hive_ce/hive.dart';
// import 'package:hive_test/hive_test.dart';
// import 'package:path_provider/path_provider.dart';
// import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart';
diff --git a/test/services/node_service_test.dart b/test/services/node_service_test.dart
index 9a80477..8d4d664 100644
--- a/test/services/node_service_test.dart
+++ b/test/services/node_service_test.dart
@@ -1,7 +1,7 @@
// TODO MWC
import 'package:flutter_test/flutter_test.dart';
-import 'package:hive/hive.dart';
+import 'package:hive_ce/hive.dart';
import 'package:hive_test/hive_test.dart';
import 'package:stackwallet/app_config.dart';
import 'package:stackwallet/db/hive/db.dart';
@@ -242,8 +242,9 @@ void main() {
final fakeStore = FakeSecureStorage();
final service = NodeService(secureStorageInterface: fakeStore);
final nodes = service.nodes;
- final defaults =
- AppConfig.coins.map((e) => e.defaultNode(isPrimary: true)).toList();
+ final defaults = AppConfig.coins
+ .map((e) => e.defaultNode(isPrimary: true))
+ .toList();
nodes.sort((a, b) => a.id.compareTo(b.id));
defaults.sort((a, b) => a.id.compareTo(b.id));
Why this scored 31/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.