From b2b0380ceec64eee1f3f39c48cbb754ec3669778 Mon Sep 17 00:00:00 2001 From: redDwarf03 Date: Fri, 8 Nov 2024 10:14:55 +0100 Subject: [PATCH 1/4] Add defTokensRepository provider --- CHANGELOG.md | 4 + lib/src/application/def_tokens.dart | 24 ++++ lib/src/application/def_tokens.g.dart | 193 ++++++++++++++++++++++++++ pubspec.yaml | 2 +- 4 files changed, 222 insertions(+), 1 deletion(-) create mode 100644 lib/src/application/def_tokens.dart create mode 100644 lib/src/application/def_tokens.g.dart diff --git a/CHANGELOG.md b/CHANGELOG.md index 50078da..7323a5e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 3.2.3 + +* Add `defTokensRepository` provider + # 3.2.2 * Use MediaQuery.sizeOf(context) instead of MediaQuery.of(context).size diff --git a/lib/src/application/def_tokens.dart b/lib/src/application/def_tokens.dart new file mode 100644 index 0000000..2653786 --- /dev/null +++ b/lib/src/application/def_tokens.dart @@ -0,0 +1,24 @@ +import 'package:archethic_dapp_framework_flutter/src/domain/models/ae_token.dart'; +import 'package:archethic_dapp_framework_flutter/src/domain/models/environment.dart'; +import 'package:archethic_dapp_framework_flutter/src/infrastructure/def_tokens.repository.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:riverpod_annotation/riverpod_annotation.dart'; + +part 'def_tokens.g.dart'; + +@riverpod +DefTokensRepositoryImpl defTokensRepositoryImpl( + Ref ref, +) => + DefTokensRepositoryImpl(); + +@riverpod +Future getDefToken( + Ref ref, + Environment environment, + String address, +) async { + return ref + .read(defTokensRepositoryImplProvider) + .getDefToken(environment, address); +} diff --git a/lib/src/application/def_tokens.g.dart b/lib/src/application/def_tokens.g.dart new file mode 100644 index 0000000..288c120 --- /dev/null +++ b/lib/src/application/def_tokens.g.dart @@ -0,0 +1,193 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'def_tokens.dart'; + +// ************************************************************************** +// RiverpodGenerator +// ************************************************************************** + +String _$defTokensRepositoryImplHash() => + r'122b13dce1c40b8bb0c2f5d5d0ab2d3825aa7e9c'; + +/// See also [defTokensRepositoryImpl]. +@ProviderFor(defTokensRepositoryImpl) +final defTokensRepositoryImplProvider = + AutoDisposeProvider.internal( + defTokensRepositoryImpl, + name: r'defTokensRepositoryImplProvider', + debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') + ? null + : _$defTokensRepositoryImplHash, + dependencies: null, + allTransitiveDependencies: null, +); + +typedef DefTokensRepositoryImplRef + = AutoDisposeProviderRef; +String _$getDefTokenHash() => r'92cfb34467f55442f12a48ae4261beaf2b515ad8'; + +/// Copied from Dart SDK +class _SystemHash { + _SystemHash._(); + + static int combine(int hash, int value) { + // ignore: parameter_assignments + hash = 0x1fffffff & (hash + value); + // ignore: parameter_assignments + hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); + return hash ^ (hash >> 6); + } + + static int finish(int hash) { + // ignore: parameter_assignments + hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); + // ignore: parameter_assignments + hash = hash ^ (hash >> 11); + return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); + } +} + +/// See also [getDefToken]. +@ProviderFor(getDefToken) +const getDefTokenProvider = GetDefTokenFamily(); + +/// See also [getDefToken]. +class GetDefTokenFamily extends Family> { + /// See also [getDefToken]. + const GetDefTokenFamily(); + + /// See also [getDefToken]. + GetDefTokenProvider call( + Environment environment, + String address, + ) { + return GetDefTokenProvider( + environment, + address, + ); + } + + @override + GetDefTokenProvider getProviderOverride( + covariant GetDefTokenProvider provider, + ) { + return call( + provider.environment, + provider.address, + ); + } + + static const Iterable? _dependencies = null; + + @override + Iterable? get dependencies => _dependencies; + + static const Iterable? _allTransitiveDependencies = null; + + @override + Iterable? get allTransitiveDependencies => + _allTransitiveDependencies; + + @override + String? get name => r'getDefTokenProvider'; +} + +/// See also [getDefToken]. +class GetDefTokenProvider extends AutoDisposeFutureProvider { + /// See also [getDefToken]. + GetDefTokenProvider( + Environment environment, + String address, + ) : this._internal( + (ref) => getDefToken( + ref as GetDefTokenRef, + environment, + address, + ), + from: getDefTokenProvider, + name: r'getDefTokenProvider', + debugGetCreateSourceHash: + const bool.fromEnvironment('dart.vm.product') + ? null + : _$getDefTokenHash, + dependencies: GetDefTokenFamily._dependencies, + allTransitiveDependencies: + GetDefTokenFamily._allTransitiveDependencies, + environment: environment, + address: address, + ); + + GetDefTokenProvider._internal( + super._createNotifier, { + required super.name, + required super.dependencies, + required super.allTransitiveDependencies, + required super.debugGetCreateSourceHash, + required super.from, + required this.environment, + required this.address, + }) : super.internal(); + + final Environment environment; + final String address; + + @override + Override overrideWith( + FutureOr Function(GetDefTokenRef provider) create, + ) { + return ProviderOverride( + origin: this, + override: GetDefTokenProvider._internal( + (ref) => create(ref as GetDefTokenRef), + from: from, + name: null, + dependencies: null, + allTransitiveDependencies: null, + debugGetCreateSourceHash: null, + environment: environment, + address: address, + ), + ); + } + + @override + AutoDisposeFutureProviderElement createElement() { + return _GetDefTokenProviderElement(this); + } + + @override + bool operator ==(Object other) { + return other is GetDefTokenProvider && + other.environment == environment && + other.address == address; + } + + @override + int get hashCode { + var hash = _SystemHash.combine(0, runtimeType.hashCode); + hash = _SystemHash.combine(hash, environment.hashCode); + hash = _SystemHash.combine(hash, address.hashCode); + + return _SystemHash.finish(hash); + } +} + +mixin GetDefTokenRef on AutoDisposeFutureProviderRef { + /// The parameter `environment` of this provider. + Environment get environment; + + /// The parameter `address` of this provider. + String get address; +} + +class _GetDefTokenProviderElement + extends AutoDisposeFutureProviderElement with GetDefTokenRef { + _GetDefTokenProviderElement(super.provider); + + @override + Environment get environment => (origin as GetDefTokenProvider).environment; + @override + String get address => (origin as GetDefTokenProvider).address; +} +// ignore_for_file: type=lint +// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member diff --git a/pubspec.yaml b/pubspec.yaml index fe3af4c..ac92955 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: archethic_dapp_framework_flutter description: An internal framework for archethic flutter development homepage: https://github.com/archethic-foundation/archethic-dapp-framework-flutter -version: 3.2.2 +version: 3.2.3 environment: sdk: ">=3.3.0 <4.0.0" From 705a530c37f13e214d7c4e0b1092d8a1e858d40a Mon Sep 17 00:00:00 2001 From: redDwarf03 Date: Fri, 8 Nov 2024 10:21:07 +0100 Subject: [PATCH 2/4] chore: :arrow_up: Upgrade flutter & riverpod versions --- .../localizations-ae-dapp-framework.dart | 2 + .../localizations-ae-dapp-framework_en.dart | 2 + .tool-versions | 2 +- analysis_options.yaml | 2 + lib/src/application/ae_token.dart | 3 +- lib/src/application/ae_token.g.dart | 6 +- lib/src/application/api_service.dart | 3 +- lib/src/application/api_service.g.dart | 6 +- lib/src/application/coin_price.dart | 5 +- lib/src/application/coin_price.g.dart | 12 ++- lib/src/application/def_tokens.g.dart | 6 +- lib/src/application/oracle/provider.g.dart | 2 +- lib/src/application/ucids_tokens.dart | 7 +- lib/src/application/ucids_tokens.g.dart | 14 ++- lib/src/application/verified_tokens.dart | 7 +- lib/src/application/verified_tokens.g.dart | 14 ++- lib/src/application/version.dart | 3 +- lib/src/application/version.g.dart | 6 +- pubspec.lock | 97 +++++++++++++++---- pubspec.yaml | 8 +- 20 files changed, 154 insertions(+), 53 deletions(-) diff --git a/.dart_tool/flutter_gen/gen_l10n/localizations-ae-dapp-framework.dart b/.dart_tool/flutter_gen/gen_l10n/localizations-ae-dapp-framework.dart index d2d3871..0b06305 100644 --- a/.dart_tool/flutter_gen/gen_l10n/localizations-ae-dapp-framework.dart +++ b/.dart_tool/flutter_gen/gen_l10n/localizations-ae-dapp-framework.dart @@ -8,6 +8,8 @@ import 'package:intl/intl.dart' as intl; import 'localizations-ae-dapp-framework_en.dart'; import 'localizations-ae-dapp-framework_fr.dart'; +// ignore_for_file: type=lint + /// Callers can lookup localized strings with an instance of AppLocalizations /// returned by `AppLocalizations.of(context)`. /// diff --git a/.dart_tool/flutter_gen/gen_l10n/localizations-ae-dapp-framework_en.dart b/.dart_tool/flutter_gen/gen_l10n/localizations-ae-dapp-framework_en.dart index a12b7a8..a7aa93c 100644 --- a/.dart_tool/flutter_gen/gen_l10n/localizations-ae-dapp-framework_en.dart +++ b/.dart_tool/flutter_gen/gen_l10n/localizations-ae-dapp-framework_en.dart @@ -1,5 +1,7 @@ import 'localizations-ae-dapp-framework.dart'; +// ignore_for_file: type=lint + /// The translations for English (`en`). class AppLocalizationsEn extends AppLocalizations { AppLocalizationsEn([String locale = 'en']) : super(locale); diff --git a/.tool-versions b/.tool-versions index 183c1de..1e2caaf 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1 +1 @@ -flutter 3.22.3-stable +flutter 3.24.4-stable diff --git a/analysis_options.yaml b/analysis_options.yaml index d80d20f..efe43e3 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -13,6 +13,8 @@ analyzer: - lib/src/l10n/* - "**/*.freezed.dart" - "**/*.g.dart" + plugins: + - custom_lint language: strict-casts: true diff --git a/lib/src/application/ae_token.dart b/lib/src/application/ae_token.dart index 468b55b..d2a1cab 100644 --- a/lib/src/application/ae_token.dart +++ b/lib/src/application/ae_token.dart @@ -1,13 +1,14 @@ import 'package:archethic_dapp_framework_flutter/archethic_dapp_framework_flutter.dart' as aedappfm; import 'package:archethic_dapp_framework_flutter/src/domain/models/ae_token.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; part 'ae_token.g.dart'; @riverpod Future _estimateTokenInFiat( - _EstimateTokenInFiatRef ref, + Ref ref, AEToken token, ) async { if (token.symbol == 'UCO') { diff --git a/lib/src/application/ae_token.g.dart b/lib/src/application/ae_token.g.dart index af155b8..ab0d8f5 100644 --- a/lib/src/application/ae_token.g.dart +++ b/lib/src/application/ae_token.g.dart @@ -7,7 +7,7 @@ part of 'ae_token.dart'; // ************************************************************************** String _$estimateTokenInFiatHash() => - r'3625a125152a8d63971b251480621115fa878abf'; + r'9380fec22b438a5e643c8b230f0c23d1c8745eb1'; /// Copied from Dart SDK class _SystemHash { @@ -143,6 +143,8 @@ class _EstimateTokenInFiatProvider extends AutoDisposeFutureProvider { } } +@Deprecated('Will be removed in 3.0. Use Ref instead') +// ignore: unused_element mixin _EstimateTokenInFiatRef on AutoDisposeFutureProviderRef { /// The parameter `token` of this provider. AEToken get token; @@ -157,4 +159,4 @@ class _EstimateTokenInFiatProviderElement AEToken get token => (origin as _EstimateTokenInFiatProvider).token; } // ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member +// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/src/application/api_service.dart b/lib/src/application/api_service.dart index 573b1e0..cf53935 100644 --- a/lib/src/application/api_service.dart +++ b/lib/src/application/api_service.dart @@ -1,12 +1,13 @@ import 'package:archethic_dapp_framework_flutter/src/domain/models/environment.dart'; import 'package:archethic_lib_dart/archethic_lib_dart.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; part 'api_service.g.dart'; @riverpod ApiService apiService( - ApiServiceRef ref, + Ref ref, Environment environment, ) => ApiService(environment.endpoint); diff --git a/lib/src/application/api_service.g.dart b/lib/src/application/api_service.g.dart index 238e294..cd81d42 100644 --- a/lib/src/application/api_service.g.dart +++ b/lib/src/application/api_service.g.dart @@ -6,7 +6,7 @@ part of 'api_service.dart'; // RiverpodGenerator // ************************************************************************** -String _$apiServiceHash() => r'01ee6186e17e769a292d6287c4b48bd0eb637acf'; +String _$apiServiceHash() => r'b9a10ec12ecc7ea5cf78d2eca9458a796871dc14'; /// Copied from Dart SDK class _SystemHash { @@ -142,6 +142,8 @@ class ApiServiceProvider extends AutoDisposeProvider { } } +@Deprecated('Will be removed in 3.0. Use Ref instead') +// ignore: unused_element mixin ApiServiceRef on AutoDisposeProviderRef { /// The parameter `environment` of this provider. Environment get environment; @@ -155,4 +157,4 @@ class _ApiServiceProviderElement extends AutoDisposeProviderElement Environment get environment => (origin as ApiServiceProvider).environment; } // ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member +// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/src/application/coin_price.dart b/lib/src/application/coin_price.dart index fc046ed..954a7e6 100644 --- a/lib/src/application/coin_price.dart +++ b/lib/src/application/coin_price.dart @@ -2,6 +2,7 @@ import 'dart:async'; import 'package:archethic_dapp_framework_flutter/archethic_dapp_framework_flutter.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:logging/logging.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; @@ -42,13 +43,13 @@ class _CoinPricesNotifier extends _$CoinPricesNotifier { @riverpod CoinPriceRepositoryImpl _coinPriceRepository( - _CoinPriceRepositoryRef ref, + Ref ref, ) => CoinPriceRepositoryImpl(); @riverpod Future _coinPrice( - _CoinPriceRef ref, { + Ref ref, { required String address, Environment? environment, }) async { diff --git a/lib/src/application/coin_price.g.dart b/lib/src/application/coin_price.g.dart index 7bb2743..c617973 100644 --- a/lib/src/application/coin_price.g.dart +++ b/lib/src/application/coin_price.g.dart @@ -7,7 +7,7 @@ part of 'coin_price.dart'; // ************************************************************************** String _$coinPriceRepositoryHash() => - r'6432142cf71159eeb175c588c1bf1116d557da58'; + r'6dcbcdb051cb63028959c3e48c1456e63c39120d'; /// See also [_coinPriceRepository]. @ProviderFor(_coinPriceRepository) @@ -22,9 +22,11 @@ final _coinPriceRepositoryProvider = allTransitiveDependencies: null, ); +@Deprecated('Will be removed in 3.0. Use Ref instead') +// ignore: unused_element typedef _CoinPriceRepositoryRef = AutoDisposeProviderRef; -String _$coinPriceHash() => r'ac5c49bfed4afd7b32235774ddbf4b3489b48e46'; +String _$coinPriceHash() => r'ae132cff68c2d792031208693b5023775e4a9cbb'; /// Copied from Dart SDK class _SystemHash { @@ -172,6 +174,8 @@ class _CoinPriceProvider extends AutoDisposeFutureProvider { } } +@Deprecated('Will be removed in 3.0. Use Ref instead') +// ignore: unused_element mixin _CoinPriceRef on AutoDisposeFutureProviderRef { /// The parameter `address` of this provider. String get address; @@ -191,7 +195,7 @@ class _CoinPriceProviderElement extends AutoDisposeFutureProviderElement } String _$coinPricesNotifierHash() => - r'6b372d2331a900161bcb22ba51bb5da8e0141e79'; + r'b3a6a14230dab614d3b92c766fb43598417597fb'; /// See also [_CoinPricesNotifier]. @ProviderFor(_CoinPricesNotifier) @@ -208,4 +212,4 @@ final _coinPricesNotifierProvider = typedef _$CoinPricesNotifier = AutoDisposeNotifier; // ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member +// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/src/application/def_tokens.g.dart b/lib/src/application/def_tokens.g.dart index 288c120..185c118 100644 --- a/lib/src/application/def_tokens.g.dart +++ b/lib/src/application/def_tokens.g.dart @@ -22,6 +22,8 @@ final defTokensRepositoryImplProvider = allTransitiveDependencies: null, ); +@Deprecated('Will be removed in 3.0. Use Ref instead') +// ignore: unused_element typedef DefTokensRepositoryImplRef = AutoDisposeProviderRef; String _$getDefTokenHash() => r'92cfb34467f55442f12a48ae4261beaf2b515ad8'; @@ -172,6 +174,8 @@ class GetDefTokenProvider extends AutoDisposeFutureProvider { } } +@Deprecated('Will be removed in 3.0. Use Ref instead') +// ignore: unused_element mixin GetDefTokenRef on AutoDisposeFutureProviderRef { /// The parameter `environment` of this provider. Environment get environment; @@ -190,4 +194,4 @@ class _GetDefTokenProviderElement String get address => (origin as GetDefTokenProvider).address; } // ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member +// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/src/application/oracle/provider.g.dart b/lib/src/application/oracle/provider.g.dart index aaa6a3d..26fcd7f 100644 --- a/lib/src/application/oracle/provider.g.dart +++ b/lib/src/application/oracle/provider.g.dart @@ -24,4 +24,4 @@ final _archethicOracleUCONotifierProvider = AutoDisposeNotifierProvider< typedef _$ArchethicOracleUCONotifier = AutoDisposeNotifier; // ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member +// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/src/application/ucids_tokens.dart b/lib/src/application/ucids_tokens.dart index a59ba92..8a6608c 100644 --- a/lib/src/application/ucids_tokens.dart +++ b/lib/src/application/ucids_tokens.dart @@ -1,11 +1,12 @@ import 'package:archethic_dapp_framework_flutter/archethic_dapp_framework_flutter.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; part 'ucids_tokens.g.dart'; @riverpod Future> _ucidsTokens( - _UcidsTokensRef ref, { + Ref ref, { Environment? environment, }) async { if (environment != null) { @@ -28,7 +29,7 @@ Future> _ucidsTokens( @riverpod Future _ucid( - _UcidRef ref, { + Ref ref, { required String address, Environment? environment, }) async { @@ -41,7 +42,7 @@ Future _ucid( @riverpod UcidsTokensRepositoryImpl _ucidsTokensRepository( - _UcidsTokensRepositoryRef ref, + Ref ref, ) => UcidsTokensRepositoryImpl(); diff --git a/lib/src/application/ucids_tokens.g.dart b/lib/src/application/ucids_tokens.g.dart index 3509865..4366100 100644 --- a/lib/src/application/ucids_tokens.g.dart +++ b/lib/src/application/ucids_tokens.g.dart @@ -6,7 +6,7 @@ part of 'ucids_tokens.dart'; // RiverpodGenerator // ************************************************************************** -String _$ucidsTokensHash() => r'0fed124f581f84881a8a9e85b49e377334fc922b'; +String _$ucidsTokensHash() => r'7b1be27e366d2e26ea4b641f49192e9af3c8e2bc'; /// Copied from Dart SDK class _SystemHash { @@ -142,6 +142,8 @@ class _UcidsTokensProvider extends AutoDisposeFutureProvider> { } } +@Deprecated('Will be removed in 3.0. Use Ref instead') +// ignore: unused_element mixin _UcidsTokensRef on AutoDisposeFutureProviderRef> { /// The parameter `environment` of this provider. Environment? get environment; @@ -156,7 +158,7 @@ class _UcidsTokensProviderElement Environment? get environment => (origin as _UcidsTokensProvider).environment; } -String _$ucidHash() => r'e812831521689c4d5aa24eaea82ac52e1f6ff812'; +String _$ucidHash() => r'4ebdadf9d4949befd9f859e31f1c95fa59509417'; /// See also [_ucid]. @ProviderFor(_ucid) @@ -280,6 +282,8 @@ class _UcidProvider extends AutoDisposeFutureProvider { } } +@Deprecated('Will be removed in 3.0. Use Ref instead') +// ignore: unused_element mixin _UcidRef on AutoDisposeFutureProviderRef { /// The parameter `address` of this provider. String get address; @@ -299,7 +303,7 @@ class _UcidProviderElement extends AutoDisposeFutureProviderElement } String _$ucidsTokensRepositoryHash() => - r'dbdd645655354e9a475a86e6ad929258d479133c'; + r'3ed9d212ff21a0982591184a165bb4e9d4e103a8'; /// See also [_ucidsTokensRepository]. @ProviderFor(_ucidsTokensRepository) @@ -314,7 +318,9 @@ final _ucidsTokensRepositoryProvider = allTransitiveDependencies: null, ); +@Deprecated('Will be removed in 3.0. Use Ref instead') +// ignore: unused_element typedef _UcidsTokensRepositoryRef = AutoDisposeProviderRef; // ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member +// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/src/application/verified_tokens.dart b/lib/src/application/verified_tokens.dart index dae2b26..c9929b8 100644 --- a/lib/src/application/verified_tokens.dart +++ b/lib/src/application/verified_tokens.dart @@ -2,13 +2,14 @@ import 'package:archethic_dapp_framework_flutter/src/application/api_service.dar import 'package:archethic_dapp_framework_flutter/src/domain/models/environment.dart'; import 'package:archethic_dapp_framework_flutter/src/domain/repositories/tokens/verified_tokens.repository.dart'; import 'package:archethic_dapp_framework_flutter/src/infrastructure/verified_tokens.repository.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; part 'verified_tokens.g.dart'; @riverpod VerifiedTokensRepositoryInterface _verifiedTokensRepository( - _VerifiedTokensRepositoryRef ref, + Ref ref, Environment environment, ) { final apiService = ref.watch(apiServiceProvider(environment)); @@ -20,7 +21,7 @@ VerifiedTokensRepositoryInterface _verifiedTokensRepository( @riverpod Future> _verifiedTokensByNetwork( - _VerifiedTokensByNetworkRef ref, + Ref ref, Environment environment, ) async { return ref @@ -30,7 +31,7 @@ Future> _verifiedTokensByNetwork( @riverpod Future _isVerifiedToken( - _IsVerifiedTokenRef ref, + Ref ref, Environment environment, String address, ) async { diff --git a/lib/src/application/verified_tokens.g.dart b/lib/src/application/verified_tokens.g.dart index 8a711d8..2978393 100644 --- a/lib/src/application/verified_tokens.g.dart +++ b/lib/src/application/verified_tokens.g.dart @@ -7,7 +7,7 @@ part of 'verified_tokens.dart'; // ************************************************************************** String _$verifiedTokensRepositoryHash() => - r'e8bec28549349b82be3c40c9d2f0253e4cda472c'; + r'ab387489895918941c15e73ecc866e6e15346543'; /// Copied from Dart SDK class _SystemHash { @@ -149,6 +149,8 @@ class _VerifiedTokensRepositoryProvider } } +@Deprecated('Will be removed in 3.0. Use Ref instead') +// ignore: unused_element mixin _VerifiedTokensRepositoryRef on AutoDisposeProviderRef { /// The parameter `environment` of this provider. @@ -166,7 +168,7 @@ class _VerifiedTokensRepositoryProviderElement } String _$verifiedTokensByNetworkHash() => - r'2504c5530c3cc8eeaf5d0b7889ca5b8ee1ac3078'; + r'f1db2b5a32e6b1d92e1f080e7e31a9d8ea142fe4'; /// See also [_verifiedTokensByNetwork]. @ProviderFor(_verifiedTokensByNetwork) @@ -284,6 +286,8 @@ class _VerifiedTokensByNetworkProvider } } +@Deprecated('Will be removed in 3.0. Use Ref instead') +// ignore: unused_element mixin _VerifiedTokensByNetworkRef on AutoDisposeFutureProviderRef> { /// The parameter `environment` of this provider. @@ -300,7 +304,7 @@ class _VerifiedTokensByNetworkProviderElement (origin as _VerifiedTokensByNetworkProvider).environment; } -String _$isVerifiedTokenHash() => r'def427a75540acd4428768a4ae59f02c2201ff79'; +String _$isVerifiedTokenHash() => r'df6167474a17c69a944cf0450a794020f0d88a56'; /// See also [_isVerifiedToken]. @ProviderFor(_isVerifiedToken) @@ -427,6 +431,8 @@ class _IsVerifiedTokenProvider extends AutoDisposeFutureProvider { } } +@Deprecated('Will be removed in 3.0. Use Ref instead') +// ignore: unused_element mixin _IsVerifiedTokenRef on AutoDisposeFutureProviderRef { /// The parameter `environment` of this provider. Environment get environment; @@ -446,4 +452,4 @@ class _IsVerifiedTokenProviderElement String get address => (origin as _IsVerifiedTokenProvider).address; } // ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member +// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/lib/src/application/version.dart b/lib/src/application/version.dart index bbe058c..3bfdd05 100644 --- a/lib/src/application/version.dart +++ b/lib/src/application/version.dart @@ -1,5 +1,6 @@ /// SPDX-License-Identifier: AGPL-3.0-or-later import 'package:archethic_dapp_framework_flutter/src/l10n/localizations-ae-dapp-framework.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:package_info_plus/package_info_plus.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; @@ -7,7 +8,7 @@ part 'version.g.dart'; @riverpod Future versionString( - VersionStringRef ref, + Ref ref, AppLocalizations localizations, ) async { final packageInfo = await PackageInfo.fromPlatform(); diff --git a/lib/src/application/version.g.dart b/lib/src/application/version.g.dart index 7ea7e97..c268827 100644 --- a/lib/src/application/version.g.dart +++ b/lib/src/application/version.g.dart @@ -6,7 +6,7 @@ part of 'version.dart'; // RiverpodGenerator // ************************************************************************** -String _$versionStringHash() => r'8283c41db98410f65dea4843fc564f26b07cc818'; +String _$versionStringHash() => r'0bcb9712b9031c87cc3cc38dbc34cfb04956077b'; /// Copied from Dart SDK class _SystemHash { @@ -143,6 +143,8 @@ class VersionStringProvider extends AutoDisposeFutureProvider { } } +@Deprecated('Will be removed in 3.0. Use Ref instead') +// ignore: unused_element mixin VersionStringRef on AutoDisposeFutureProviderRef { /// The parameter `localizations` of this provider. AppLocalizations get localizations; @@ -157,4 +159,4 @@ class _VersionStringProviderElement (origin as VersionStringProvider).localizations; } // ignore_for_file: type=lint -// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member +// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package diff --git a/pubspec.lock b/pubspec.lock index 68e58cd..a685ee9 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,10 +5,15 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - sha256: "0b2f2bd91ba804e53a61d757b986f89f1f9eaed5b11e4b2f5a2468d86d6c9fc7" + sha256: f256b0c0ba6c7577c15e2e4e114755640a875e885099367bf6e012b19314c834 url: "https://pub.dev" source: hosted - version: "67.0.0" + version: "72.0.0" + _macros: + dependency: transitive + description: dart + source: sdk + version: "0.3.2" adaptive_number: dependency: transitive description: @@ -21,10 +26,10 @@ packages: dependency: transitive description: name: analyzer - sha256: "37577842a27e4338429a1cbc32679d508836510b056f1eedf0c8d20e39c1383d" + sha256: b652861553cd3990d8ed361f7979dc6d7053a9ac8843fa73820ab68ce5410139 url: "https://pub.dev" source: hosted - version: "6.4.1" + version: "6.7.0" analyzer_plugin: dependency: transitive description: @@ -169,6 +174,22 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.3" + ci: + dependency: transitive + description: + name: ci + sha256: "145d095ce05cddac4d797a158bc4cf3b6016d1fe63d8c3d2fbd7212590adca13" + url: "https://pub.dev" + source: hosted + version: "0.1.0" + cli_util: + dependency: transitive + description: + name: cli_util + sha256: ff6785f7e9e3c38ac98b2fb035701789de90154024a75b6cb926445e83197d1c + url: "https://pub.dev" + source: hosted + version: "0.4.2" clock: dependency: transitive description: @@ -225,6 +246,22 @@ packages: url: "https://pub.dev" source: hosted version: "2.7.0" + custom_lint: + dependency: "direct dev" + description: + name: custom_lint + sha256: "7c0aec12df22f9082146c354692056677f1e70bc43471644d1fdb36c6fdda799" + url: "https://pub.dev" + source: hosted + version: "0.6.4" + custom_lint_builder: + dependency: transitive + description: + name: custom_lint_builder + sha256: d7dc41e709dde223806660268678be7993559e523eb3164e2a1425fd6f7615a9 + url: "https://pub.dev" + source: hosted + version: "0.6.4" custom_lint_core: dependency: transitive description: @@ -319,10 +356,10 @@ packages: dependency: "direct main" description: name: flutter_riverpod - sha256: "0f1974eff5bbe774bf1d870e406fc6f29e3d6f1c46bd9c58e7172ff68a785d7d" + sha256: "9532ee6db4a943a1ed8383072a2e3eeda041db5657cdf6d2acecf3c21ecbe7e1" url: "https://pub.dev" source: hosted - version: "2.5.1" + version: "2.6.1" flutter_shaders: dependency: transitive description: @@ -472,6 +509,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.0" + hotreloader: + dependency: transitive + description: + name: hotreloader + sha256: ed56fdc1f3a8ac924e717257621d09e9ec20e308ab6352a73a50a1d7a4d9158e + url: "https://pub.dev" + source: hosted + version: "4.2.0" http: dependency: "direct main" description: @@ -568,6 +613,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.0" + macros: + dependency: transitive + description: + name: macros + sha256: "0acaed5d6b7eab89f63350bccd82119e6c602df0f391260d0e32b5e23db79536" + url: "https://pub.dev" + source: hosted + version: "0.1.2-main.4" matcher: dependency: transitive description: @@ -580,18 +633,18 @@ packages: dependency: transitive description: name: material_color_utilities - sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec url: "https://pub.dev" source: hosted - version: "0.8.0" + version: "0.11.1" meta: dependency: transitive description: name: meta - sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" + sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 url: "https://pub.dev" source: hosted - version: "1.12.0" + version: "1.15.0" mime: dependency: transitive description: @@ -788,34 +841,42 @@ packages: dependency: transitive description: name: riverpod - sha256: f21b32ffd26a36555e501b04f4a5dca43ed59e16343f1a30c13632b2351dfa4d + sha256: "59062512288d3056b2321804332a13ffdd1bf16df70dcc8e506e411280a72959" url: "https://pub.dev" source: hosted - version: "2.5.1" + version: "2.6.1" riverpod_analyzer_utils: dependency: transitive description: name: riverpod_analyzer_utils - sha256: "8b71f03fc47ae27d13769496a1746332df4cec43918aeba9aff1e232783a780f" + sha256: "0dcb0af32d561f8fa000c6a6d95633c9fb08ea8a8df46e3f9daca59f11218167" url: "https://pub.dev" source: hosted - version: "0.5.1" + version: "0.5.6" riverpod_annotation: dependency: "direct main" description: name: riverpod_annotation - sha256: e5e796c0eba4030c704e9dae1b834a6541814963292839dcf9638d53eba84f5c + sha256: e14b0bf45b71326654e2705d462f21b958f987087be850afd60578fcd502d1b8 url: "https://pub.dev" source: hosted - version: "2.3.5" + version: "2.6.1" riverpod_generator: dependency: "direct dev" description: name: riverpod_generator - sha256: d451608bf17a372025fc36058863737636625dfdb7e3cbf6142e0dfeb366ab22 + sha256: "851aedac7ad52693d12af3bf6d92b1626d516ed6b764eb61bf19e968b5e0b931" url: "https://pub.dev" source: hosted - version: "2.4.0" + version: "2.6.1" + riverpod_lint: + dependency: "direct dev" + description: + name: riverpod_lint + sha256: "0684c21a9a4582c28c897d55c7b611fa59a351579061b43f8c92c005804e63a8" + url: "https://pub.dev" + source: hosted + version: "2.6.1" rxdart: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index ac92955..18773c0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -39,7 +39,7 @@ dependencies: sdk: flutter # State management - flutter_riverpod: ^2.5.1 + flutter_riverpod: ^2.6.1 # Annotations for the freezed code-generator. This package does nothing without freezed too freezed_annotation: ^2.4.1 @@ -73,7 +73,7 @@ dependencies: package_info_plus: ^8.0.2 # A package exposing annotations for riverpod_generator - riverpod_annotation: ^2.3.5 + riverpod_annotation: ^2.6.1 # Bar indicator made of a series of selected and unselected steps step_progress_indicator: ^1.0.2 @@ -87,12 +87,14 @@ dependencies: dev_dependencies: # A build system for Dart code generation and modular compilation. build_runner: ^2.4.8 + custom_lint: ^0.6.4 # Code generation for immutable classes that has a simple syntax/API without compromising on the features. freezed: ^2.4.7 # Automatically generate code for converting to and from JSON by annotating Dart classes. json_serializable: ^6.7.1 # A code generator for Riverpod. This both simplifies the syntax empowers it, such as allowing stateful hot-reload. - riverpod_generator: ^2.4.0 + riverpod_generator: ^2.6.1 + riverpod_lint: ^2.4.0 # Automated tests test: ^1.25.2 From 6c124f8f2879432ddef6b8440037050f705d5a70 Mon Sep 17 00:00:00 2001 From: redDwarf03 Date: Fri, 8 Nov 2024 10:22:53 +0100 Subject: [PATCH 3/4] Upgrade flutter version --- .github/workflows/flutter-tests.yml | 2 +- .github/workflows/release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/flutter-tests.yml b/.github/workflows/flutter-tests.yml index d33c98d..535020e 100644 --- a/.github/workflows/flutter-tests.yml +++ b/.github/workflows/flutter-tests.yml @@ -17,7 +17,7 @@ jobs: uses: subosito/flutter-action@v2 with: channel: "stable" - flutter-version: '3.22.2' + flutter-version: '3.24.4' - name: Install dependencies run: flutter pub get diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bbd834f..64c0e2d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,7 +19,7 @@ jobs: uses: subosito/flutter-action@v2 with: channel: "stable" - flutter-version: "3.22.3" + flutter-version: "3.24.4" - name: Install dependencies run: flutter pub get - name: Publish From aea11ea6f6c060b7efbf11834cecd6601956406e Mon Sep 17 00:00:00 2001 From: redDwarf03 Date: Fri, 8 Nov 2024 14:02:10 +0100 Subject: [PATCH 4/4] chore: :bug: Use watch --- lib/src/application/def_tokens.dart | 2 +- lib/src/application/def_tokens.g.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/src/application/def_tokens.dart b/lib/src/application/def_tokens.dart index 2653786..e524bfd 100644 --- a/lib/src/application/def_tokens.dart +++ b/lib/src/application/def_tokens.dart @@ -19,6 +19,6 @@ Future getDefToken( String address, ) async { return ref - .read(defTokensRepositoryImplProvider) + .watch(defTokensRepositoryImplProvider) .getDefToken(environment, address); } diff --git a/lib/src/application/def_tokens.g.dart b/lib/src/application/def_tokens.g.dart index 185c118..64429ea 100644 --- a/lib/src/application/def_tokens.g.dart +++ b/lib/src/application/def_tokens.g.dart @@ -26,7 +26,7 @@ final defTokensRepositoryImplProvider = // ignore: unused_element typedef DefTokensRepositoryImplRef = AutoDisposeProviderRef; -String _$getDefTokenHash() => r'92cfb34467f55442f12a48ae4261beaf2b515ad8'; +String _$getDefTokenHash() => r'6dc037580b95cd2e73808d831eef8278bbe4eca4'; /// Copied from Dart SDK class _SystemHash {