From 34bfe45cc6e507d67078641224a7724c16408db1 Mon Sep 17 00:00:00 2001 From: Alfreedom <00tango.bromine@icloud.com> Date: Mon, 16 Feb 2026 18:59:31 +0100 Subject: [PATCH] Enable prefer_const_constructors lint and apply across all packages - Add prefer_const_constructors and avoid_field_initializers_in_const_classes lint rules to analysis_options.yaml in all packages - Apply const keyword to constructor invocations throughout the codebase - Convert final field initializers to getters in const classes (basic_event.dart _ErrorOptions, _ModalTrackOptions) - Standardize analysis_options.yaml in pos_client to use package:lints/recommended.yaml - Sort dependencies in pubspec.yaml files - Switch to local path dependencies for development Co-authored-by: Cursor --- packages/pos_client/analysis_options.yaml | 44 ++- .../pos_client/example/analysis_options.yaml | 26 +- packages/pos_client/example/lib/main.dart | 2 +- .../providers/available_tokens_provider.dart | 50 +-- .../lib/providers/pos_client_provider.dart | 4 +- .../example/lib/screens/amount_screen.dart | 6 +- .../example/lib/screens/network_screen.dart | 12 +- .../example/lib/screens/payment_screen.dart | 18 +- .../example/lib/screens/token_screen.dart | 10 +- .../example/lib/screens/welcome_screen.dart | 18 +- .../example/lib/widgets/dtc_header.dart | 4 +- packages/pos_client/example/pubspec.yaml | 7 +- packages/pos_client/lib/pos_client_impl.dart | 6 +- .../lib/services/validator_service.dart | 2 +- packages/pos_client/pubspec.yaml | 6 +- .../test/blockchain_service_test.dart | 34 +-- packages/pos_client/test/error_test.dart | 58 ++-- .../pos_client/test/result_models_test.dart | 286 +++++++++--------- packages/reown_appkit/analysis_options.yaml | 3 + .../example/base/analysis_options.yaml | 3 + .../example/base/ios/Podfile.lock | 6 - .../reown_appkit/example/base/lib/main.dart | 24 +- .../example/base/lib/main_dwe.dart | 24 +- .../example/base/lib/pages/connect_page.dart | 12 +- .../example/base/lib/pages/pairings_page.dart | 2 +- .../example/base/lib/pages/settings_page.dart | 2 +- .../base/lib/utils/crypto/helpers.dart | 6 +- .../base/lib/widgets/method_dialog.dart | 4 +- .../example/modal/analysis_options.yaml | 3 + .../example/modal/lib/home_page.dart | 18 +- .../modal/lib/widgets/method_dialog.dart | 4 +- .../modal/lib/widgets/session_widget.dart | 4 +- .../base/services/models/asset_models.dart | 4 +- .../lib/modal/appkit_modal_impl.dart | 17 +- .../models/public/appkit_modal_session.dart | 4 +- .../lib/modal/pages/account_page.dart | 20 +- .../lib/modal/pages/activity_page.dart | 4 +- .../lib/modal/pages/approve_siwe.dart | 6 +- .../lib/modal/pages/connect_wallet_page.dart | 8 +- .../lib/modal/pages/connet_network_page.dart | 4 +- .../modal/pages/farcaster_qrcode_page.dart | 6 +- .../pages/preview_send/preview_send_evm.dart | 2 +- .../preview_send/preview_send_solana.dart | 2 +- .../lib/modal/pages/preview_send/widgets.dart | 4 +- .../public/appkit_modal_all_wallets_page.dart | 6 +- .../appkit_modal_main_wallets_page.dart | 2 +- .../public/appkit_modal_qrcode_page.dart | 2 +- .../public/dwe/appkit_modal_dwe_page.dart | 2 +- .../dwe/configured_assets_selector_page.dart | 6 +- .../dwe/exchange_assets_selector_page.dart | 34 ++- .../public/dwe/payment_process_page.dart | 44 +-- .../public/dwe/widgets/amount_selector.dart | 2 +- .../public/dwe/widgets/asset_button.dart | 10 +- .../public/dwe/widgets/exchanges_list.dart | 8 +- .../pages/receive_compatible_networks.dart | 2 +- .../lib/modal/pages/receive_page.dart | 2 +- .../lib/modal/pages/select_token_page.dart | 8 +- .../lib/modal/pages/send_page.dart | 10 +- .../lib/modal/pages/social_login_page.dart | 4 +- .../lib/modal/pages/wallet_features_page.dart | 18 +- .../models/analytics_event.dart | 2 +- .../blockchain_service.dart | 2 +- .../coinbase_service/coinbase_service.dart | 2 +- .../services/dwe_service/dwe_service.dart | 12 +- .../services/magic_service/magic_service.dart | 6 +- .../magic_service/models/frame_message.dart | 2 +- .../phantom_service/phantom_helper.dart | 2 +- .../services/siwe_service/siwe_service.dart | 2 +- .../solflare_service/solflare_helper.dart | 2 +- .../services/transfers/transfers_service.dart | 2 +- .../public/appkit_modal_default_networks.dart | 28 +- .../lib/modal/utils/render_utils.dart | 10 +- .../widgets/buttons/simple_icon_button.dart | 2 +- .../buttons/social_login_buttons_view.dart | 2 +- .../modal/widgets/lists/activity_item.dart | 32 +- .../lists/grid_items/wallet_grid_item.dart | 8 +- .../lists/list_items/all_wallets_item.dart | 4 +- .../lists/list_items/base_list_item.dart | 2 +- .../list_items/download_wallet_item.dart | 2 +- .../lists/list_items/wallet_list_item.dart | 4 +- .../lib/modal/widgets/lists/wallets_list.dart | 2 +- .../miscellaneous/content_loading.dart | 7 +- .../miscellaneous/responsive_container.dart | 2 +- .../widgets/miscellaneous/searchbar.dart | 6 +- .../miscellaneous/segmented_control.dart | 6 +- .../miscellaneous/verify_otp_view.dart | 6 +- .../lib/modal/widgets/navigation/navbar.dart | 2 +- .../public/appkit_modal_account_button.dart | 14 +- .../public/appkit_modal_address_button.dart | 12 +- .../public/appkit_modal_balance_button.dart | 6 +- .../lib/modal/widgets/toast/toast.dart | 2 +- .../solana/solana_web3/src/crypto/nacl.dart | 4 +- .../rpc/methods/get_blocks_with_limit.dart | 2 +- .../src/rpc/methods/send_transaction.dart | 2 +- .../src/rpc/methods/simulate_transaction.dart | 2 +- packages/reown_appkit/pubspec.yaml | 9 +- .../dwe/dwe_service_transfers_test.dart | 27 +- .../services/transfers/quote_models_test.dart | 12 +- .../services/transfers/quote_params_test.dart | 22 +- .../transfers/quote_results_test.dart | 14 +- .../transfers/transfers_service_test.dart | 12 +- packages/reown_cli/analysis_options.yaml | 3 + packages/reown_core/analysis_options.yaml | 3 + packages/reown_core/lib/core_impl.dart | 2 +- .../lib/events/models/basic_event.dart | 140 ++++----- .../reown_core/lib/utils/polkadot_utils.dart | 2 +- packages/reown_core/lib/verify/verify.dart | 8 +- .../reown_core/test/relay_client_test.dart | 38 +-- .../test/verify/jwt_validation_test.dart | 2 +- .../reown_core/test/verify/verify_test.dart | 52 ++-- packages/reown_sign/analysis_options.yaml | 3 + packages/reown_sign/lib/sign_engine.dart | 6 +- .../reown_sign/lib/utils/auth_signature.dart | 2 +- packages/reown_sign/pubspec.yaml | 3 +- .../sign_approve_session_authenticate.dart | 6 +- .../test/tests/sign_authenticate.dart | 6 +- .../reown_sign/test/tvf_collection_test.dart | 110 +++---- .../reown_walletkit/analysis_options.yaml | 3 + .../example/analysis_options.yaml | 3 + .../reown_walletkit/example/ios/Podfile.lock | 14 +- .../ios/Runner.xcodeproj/project.pbxproj | 92 +++--- .../bottom_sheet/bottom_sheet_listener.dart | 2 +- .../chain_services/cosmos_service.dart | 3 +- .../chain_services/kadena_service.dart | 12 +- .../chain_services/polkadot_service.dart | 3 +- .../chain_services/solana_service.dart | 2 +- .../chain_services/stacks/stacks_service.dart | 6 +- .../chain_services/ton/ton_service.dart | 2 +- .../reown_walletkit/example/lib/main.dart | 6 +- .../example/lib/models/chain_data.dart | 12 +- .../example/lib/pages/app_detail_page.dart | 6 +- .../example/lib/pages/apps_page.dart | 2 +- .../example/lib/pages/balances_page.dart | 4 +- .../example/lib/pages/settings_page.dart | 31 +- .../example/lib/utils/constants.dart | 20 +- .../example/lib/utils/methods_utils.dart | 2 +- .../wcp_modals/wcp_confirming_payment.dart | 10 +- .../wcp_modals/wcp_get_payment_options.dart | 8 +- .../wcp_birthdate_capture.dart | 2 +- .../wcp_full_name_capture.dart | 2 +- .../wcp_information_capture_start.dart | 2 +- .../wcp_place_of_birth_capture.dart | 2 +- .../wcp_modals/wcp_payment_details.dart | 10 +- .../wcp_modals/wcp_payment_result.dart | 2 +- .../walletconnect_pay/wcp_shared_widgets.dart | 2 +- .../example/lib/widgets/pairing_item.dart | 6 +- .../example/lib/widgets/uri_input_popup.dart | 5 +- .../wc_connection_request_widget.dart | 2 +- .../wc_connection_widget_info.dart | 2 +- .../ios/Flutter/Generated.xcconfig | 2 +- .../ios/Flutter/flutter_export_environment.sh | 2 +- packages/reown_walletkit/pubspec.yaml | 12 +- packages/reown_yttrium/analysis_options.yaml | 3 + .../reown_yttrium_utils/analysis_options.yaml | 3 + .../walletconnect_pay/analysis_options.yaml | 3 + .../walletconnect_pay/example/lib/main.dart | 2 +- .../walletconnect_pay_exceptions_test.dart | 16 +- .../test/walletconnect_pay_json_test.dart | 26 +- .../test/walletconnect_pay_test.dart | 14 +- 159 files changed, 1084 insertions(+), 913 deletions(-) diff --git a/packages/pos_client/analysis_options.yaml b/packages/pos_client/analysis_options.yaml index a5744c1c..29c11762 100644 --- a/packages/pos_client/analysis_options.yaml +++ b/packages/pos_client/analysis_options.yaml @@ -1,4 +1,46 @@ -include: package:flutter_lints/flutter.yaml +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:lints/recommended.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at + # https://dart-lang.github.io/linter/lints/index.html. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + non_constant_identifier_names: false + constant_identifier_names: false + avoid_print: true + prefer_single_quotes: true + sort_pub_dependencies: true + avoid_unnecessary_containers: true + cancel_subscriptions: true + prefer_const_constructors: true + prefer_const_literals_to_create_immutables: true + avoid_field_initializers_in_const_classes: true + +analyzer: + exclude: + - '**.freezed.dart' + - '**.g.dart' + - '**/*.freezed.dart' + - '**/*.g.dart' + - '**/generated_plugin_registrant.dart' + errors: + invalid_annotation_target: ignore # Additional information about this file can be found at # https://dart.dev/guides/language/analysis-options diff --git a/packages/pos_client/example/analysis_options.yaml b/packages/pos_client/example/analysis_options.yaml index 0d290213..ac988f21 100644 --- a/packages/pos_client/example/analysis_options.yaml +++ b/packages/pos_client/example/analysis_options.yaml @@ -7,13 +7,14 @@ # The following line activates a set of recommended lints for Flutter apps, # packages, and plugins designed to encourage good coding practices. -include: package:flutter_lints/flutter.yaml +include: package:lints/recommended.yaml linter: # The lint rules applied to this project can be customized in the # section below to disable rules from the `package:flutter_lints/flutter.yaml` # included above or to enable additional rules. A list of all available lints - # and their documentation is published at https://dart.dev/lints. + # and their documentation is published at + # https://dart-lang.github.io/linter/lints/index.html. # # Instead of disabling a lint rule for the entire project in the # section below, it can also be suppressed for a single line of code @@ -21,8 +22,25 @@ linter: # `// ignore_for_file: name_of_lint` syntax on the line or in the file # producing the lint. rules: - # avoid_print: false # Uncomment to disable the `avoid_print` rule - # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + non_constant_identifier_names: false + constant_identifier_names: false + avoid_print: true + prefer_single_quotes: true + sort_pub_dependencies: true + avoid_unnecessary_containers: true + cancel_subscriptions: true + prefer_const_constructors: true + # prefer_const_literals_to_create_immutables: true + avoid_field_initializers_in_const_classes: true +analyzer: + exclude: + - '**.freezed.dart' + - '**.g.dart' + - '**/*.freezed.dart' + - '**/*.g.dart' + - '**/generated_plugin_registrant.dart' + errors: + invalid_annotation_target: ignore # Additional information about this file can be found at # https://dart.dev/guides/language/analysis-options diff --git a/packages/pos_client/example/lib/main.dart b/packages/pos_client/example/lib/main.dart index 2ff7711e..40bec710 100644 --- a/packages/pos_client/example/lib/main.dart +++ b/packages/pos_client/example/lib/main.dart @@ -4,7 +4,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter/foundation.dart' show kIsWeb; void main() { - runApp(ProviderScope(child: const MyApp())); + runApp(const ProviderScope(child: MyApp())); } class MyApp extends StatelessWidget { diff --git a/packages/pos_client/example/lib/providers/available_tokens_provider.dart b/packages/pos_client/example/lib/providers/available_tokens_provider.dart index cfd335a8..8a397c55 100644 --- a/packages/pos_client/example/lib/providers/available_tokens_provider.dart +++ b/packages/pos_client/example/lib/providers/available_tokens_provider.dart @@ -196,55 +196,61 @@ enum SupportedNetwork { PosNetwork get posNetwork { switch (this) { case SupportedNetwork.ethereum: - return PosNetwork(name: 'Ethereum', chainId: 'eip155:1'); + return const PosNetwork(name: 'Ethereum', chainId: 'eip155:1'); case SupportedNetwork.polygon: - return PosNetwork(name: 'Polygon', chainId: 'eip155:137'); + return const PosNetwork(name: 'Polygon', chainId: 'eip155:137'); case SupportedNetwork.binanceSmartChain: - return PosNetwork(name: 'BNB Smart Chain', chainId: 'eip155:56'); + return const PosNetwork(name: 'BNB Smart Chain', chainId: 'eip155:56'); case SupportedNetwork.avalanche: - return PosNetwork(name: 'Avalanche', chainId: 'eip155:43114'); + return const PosNetwork(name: 'Avalanche', chainId: 'eip155:43114'); case SupportedNetwork.arbitrum: - return PosNetwork(name: 'Arbitrum One', chainId: 'eip155:42161'); + return const PosNetwork(name: 'Arbitrum One', chainId: 'eip155:42161'); case SupportedNetwork.optimism: - return PosNetwork(name: 'Optimism', chainId: 'eip155:10'); + return const PosNetwork(name: 'Optimism', chainId: 'eip155:10'); case SupportedNetwork.base: - return PosNetwork(name: 'Base', chainId: 'eip155:8453'); + return const PosNetwork(name: 'Base', chainId: 'eip155:8453'); case SupportedNetwork.fantom: - return PosNetwork(name: 'Fantom', chainId: 'eip155:250'); + return const PosNetwork(name: 'Fantom', chainId: 'eip155:250'); case SupportedNetwork.cronos: - return PosNetwork(name: 'Cronos', chainId: 'eip155:25'); + return const PosNetwork(name: 'Cronos', chainId: 'eip155:25'); case SupportedNetwork.polygonZkEVM: - return PosNetwork(name: 'Polygon zkEVM', chainId: 'eip155:1101'); + return const PosNetwork(name: 'Polygon zkEVM', chainId: 'eip155:1101'); case SupportedNetwork.sepolia: - return PosNetwork(name: 'Sepolia ETH', chainId: 'eip155:11155111'); + return const PosNetwork( + name: 'Sepolia ETH', + chainId: 'eip155:11155111', + ); case SupportedNetwork.gnosis: - return PosNetwork(name: 'Gnosis Chain', chainId: 'eip155:100'); + return const PosNetwork(name: 'Gnosis Chain', chainId: 'eip155:100'); case SupportedNetwork.zkSyncEra: - return PosNetwork(name: 'zkSync Era', chainId: 'eip155:324'); + return const PosNetwork(name: 'zkSync Era', chainId: 'eip155:324'); case SupportedNetwork.mantle: - return PosNetwork(name: 'Mantle', chainId: 'eip155:5000'); + return const PosNetwork(name: 'Mantle', chainId: 'eip155:5000'); case SupportedNetwork.klaytn: - return PosNetwork(name: 'Klaytn Mainnet', chainId: 'eip155:8217'); + return const PosNetwork(name: 'Klaytn Mainnet', chainId: 'eip155:8217'); case SupportedNetwork.celo: - return PosNetwork(name: 'Celo', chainId: 'eip155:42220'); + return const PosNetwork(name: 'Celo', chainId: 'eip155:42220'); case SupportedNetwork.linea: - return PosNetwork(name: 'Linea', chainId: 'eip155:59144'); + return const PosNetwork(name: 'Linea', chainId: 'eip155:59144'); case SupportedNetwork.baseSepolia: - return PosNetwork(name: 'Base Sepolia', chainId: 'eip155:84531'); + return const PosNetwork(name: 'Base Sepolia', chainId: 'eip155:84531'); case SupportedNetwork.solana: - return PosNetwork( + return const PosNetwork( name: 'Solana', chainId: 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp', ); case SupportedNetwork.solanaDevnet: - return PosNetwork( + return const PosNetwork( name: 'Solana Devnet', chainId: 'solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1', ); case SupportedNetwork.tron: - return PosNetwork(name: 'Tron', chainId: 'tron:0x2b6653dc'); + return const PosNetwork(name: 'Tron', chainId: 'tron:0x2b6653dc'); case SupportedNetwork.tronTestnet: - return PosNetwork(name: 'Tron Testnet', chainId: 'tron:0xcd8690dc'); + return const PosNetwork( + name: 'Tron Testnet', + chainId: 'tron:0xcd8690dc', + ); } } } diff --git a/packages/pos_client/example/lib/providers/pos_client_provider.dart b/packages/pos_client/example/lib/providers/pos_client_provider.dart index bb69b2fe..83c09460 100644 --- a/packages/pos_client/example/lib/providers/pos_client_provider.dart +++ b/packages/pos_client/example/lib/providers/pos_client_provider.dart @@ -4,7 +4,7 @@ import 'package:pos_client/pos_client.dart'; /// Reown POS plugin instance final posClilentProvider = Provider((ref) { // [PosClient SDK API] 1. Construct your RoenPos instance - final metadata = Metadata( + final metadata = const Metadata( merchantName: 'DTC Pay', description: 'Secure Crypto Payment Terminal', url: 'https://appkit-lab.reown.com', @@ -12,7 +12,7 @@ final posClilentProvider = Provider((ref) { ); return PosClient( projectId: '50f81661a58229027394e0a19e9db752', - deviceId: "sample_pos_device_${DateTime.now().microsecondsSinceEpoch}", + deviceId: 'sample_pos_device_${DateTime.now().microsecondsSinceEpoch}', metadata: metadata, ); }); diff --git a/packages/pos_client/example/lib/screens/amount_screen.dart b/packages/pos_client/example/lib/screens/amount_screen.dart index 63c0da67..b185f67a 100644 --- a/packages/pos_client/example/lib/screens/amount_screen.dart +++ b/packages/pos_client/example/lib/screens/amount_screen.dart @@ -31,7 +31,7 @@ class _AmountScreenState extends ConsumerState { void _navigateToTokenScreen() { Navigator.push( context, - MaterialPageRoute(builder: (context) => TokenScreen()), + MaterialPageRoute(builder: (context) => const TokenScreen()), ); } @@ -171,7 +171,7 @@ class _AmountScreenState extends ConsumerState { ), ), const SizedBox(height: 10), - SizedBox( + const SizedBox( width: double.infinity, height: 56, child: DtcRestartButton(), @@ -184,7 +184,7 @@ class _AmountScreenState extends ConsumerState { ), ), ), - bottomNavigationBar: DtcFooter(), + bottomNavigationBar: const DtcFooter(), ); } } diff --git a/packages/pos_client/example/lib/screens/network_screen.dart b/packages/pos_client/example/lib/screens/network_screen.dart index 64561a11..b4951355 100644 --- a/packages/pos_client/example/lib/screens/network_screen.dart +++ b/packages/pos_client/example/lib/screens/network_screen.dart @@ -45,7 +45,7 @@ class _NetworkScreenState extends ConsumerState { return AlertDialog( title: Text('${event.runtimeType}'), content: Text(event.message), - actions: [DtcRestartButton()], + actions: [const DtcRestartButton()], ); }, ); @@ -59,7 +59,7 @@ class _NetworkScreenState extends ConsumerState { posInstance.createPaymentIntent(paymentIntents: [paymentInfo]); Navigator.push( context, - MaterialPageRoute(builder: (context) => PaymentScreen()), + MaterialPageRoute(builder: (context) => const PaymentScreen()), ); } @@ -165,7 +165,7 @@ class _NetworkScreenState extends ConsumerState { trailing: network.chainId == paymentInfo.token.network.chainId - ? Icon(Icons.check) + ? const Icon(Icons.check) : null, ), ), @@ -173,7 +173,7 @@ class _NetworkScreenState extends ConsumerState { }, itemCount: avaibleNetworks.length, separatorBuilder: (BuildContext context, int index) { - return SizedBox.square(dimension: 12.0); + return const SizedBox.square(dimension: 12.0); }, ), ), @@ -204,7 +204,7 @@ class _NetworkScreenState extends ConsumerState { ), ), const SizedBox(height: 10), - SizedBox( + const SizedBox( width: double.infinity, height: 56, child: DtcRestartButton(), @@ -217,7 +217,7 @@ class _NetworkScreenState extends ConsumerState { ), ), ), - bottomNavigationBar: DtcFooter(), + bottomNavigationBar: const DtcFooter(), ); } } diff --git a/packages/pos_client/example/lib/screens/payment_screen.dart b/packages/pos_client/example/lib/screens/payment_screen.dart index ebbba5e2..604147a0 100644 --- a/packages/pos_client/example/lib/screens/payment_screen.dart +++ b/packages/pos_client/example/lib/screens/payment_screen.dart @@ -59,7 +59,7 @@ class _PaymentScreenState extends ConsumerState { child: Column( children: [ // Screen header - DtcHeader( + const DtcHeader( title: 'Scan to Pay', description: 'Step 5: Customer scans QR', ), @@ -92,7 +92,7 @@ class _PaymentScreenState extends ConsumerState { // Payment Details Card _PaymentInfoWidget(), const SizedBox(height: 24), - SizedBox( + const SizedBox( width: double.infinity, height: 56, child: DtcRestartButton(), @@ -105,7 +105,7 @@ class _PaymentScreenState extends ConsumerState { ), ), ), - bottomNavigationBar: DtcFooter(), + bottomNavigationBar: const DtcFooter(), ); } } @@ -174,7 +174,7 @@ class __EventsListWidgetState extends ConsumerState<_EventsListWidget> { @override Widget build(BuildContext context) { if (_eventsPool.isEmpty) { - return SizedBox.shrink(); + return const SizedBox.shrink(); } final currentEvent = _eventsPool.last; return Column( @@ -234,7 +234,7 @@ class __EventsListWidgetState extends ConsumerState<_EventsListWidget> { ), Visibility( visible: isLoading && !isFailed, - child: SizedBox.square( + child: const SizedBox.square( dimension: 8, child: CircularProgressIndicator( strokeWidth: 2.0, @@ -247,7 +247,7 @@ class __EventsListWidgetState extends ConsumerState<_EventsListWidget> { child: Container( width: 10, height: 10, - decoration: BoxDecoration( + decoration: const BoxDecoration( color: Colors.red, shape: BoxShape.circle, ), @@ -277,7 +277,7 @@ class __EventsListWidgetState extends ConsumerState<_EventsListWidget> { return AlertDialog( title: Text(title), content: Text(message), - actions: [DtcRestartButton()], + actions: [const DtcRestartButton()], ); }, ); @@ -293,7 +293,7 @@ class _PaymentInfoWidget extends ConsumerWidget { children: [ Text( '\$${paymentInfo.amount}', - style: TextStyle( + style: const TextStyle( color: Colors.black, fontSize: 24, fontWeight: FontWeight.bold, @@ -303,7 +303,7 @@ class _PaymentInfoWidget extends ConsumerWidget { const SizedBox(height: 8), Text( '${paymentInfo.token.symbol.toUpperCase()} on ${paymentInfo.token.network.name}', - style: TextStyle( + style: const TextStyle( color: Colors.black, fontSize: 16, fontWeight: FontWeight.normal, diff --git a/packages/pos_client/example/lib/screens/token_screen.dart b/packages/pos_client/example/lib/screens/token_screen.dart index 2272fbfb..82d0811f 100644 --- a/packages/pos_client/example/lib/screens/token_screen.dart +++ b/packages/pos_client/example/lib/screens/token_screen.dart @@ -24,7 +24,7 @@ class _TokenScreenState extends ConsumerState { void _navigateToNetworkScreen() { Navigator.push( context, - MaterialPageRoute(builder: (context) => NetworkScreen()), + MaterialPageRoute(builder: (context) => const NetworkScreen()), ); } @@ -111,7 +111,7 @@ class _TokenScreenState extends ConsumerState { // subtitle: // 'On ${token.token.network.networkData.name}', trailing: token.selected - ? Icon(Icons.check) + ? const Icon(Icons.check) : null, ), ), @@ -119,7 +119,7 @@ class _TokenScreenState extends ConsumerState { }, itemCount: reducedTokens.length, separatorBuilder: (BuildContext context, int index) { - return SizedBox.square(dimension: 12.0); + return const SizedBox.square(dimension: 12.0); }, ), ), @@ -150,7 +150,7 @@ class _TokenScreenState extends ConsumerState { ), ), const SizedBox(height: 10), - SizedBox( + const SizedBox( width: double.infinity, height: 56, child: DtcRestartButton(), @@ -163,7 +163,7 @@ class _TokenScreenState extends ConsumerState { ), ), ), - bottomNavigationBar: DtcFooter(), + bottomNavigationBar: const DtcFooter(), ); } } diff --git a/packages/pos_client/example/lib/screens/welcome_screen.dart b/packages/pos_client/example/lib/screens/welcome_screen.dart index d0c46737..4696b504 100644 --- a/packages/pos_client/example/lib/screens/welcome_screen.dart +++ b/packages/pos_client/example/lib/screens/welcome_screen.dart @@ -85,7 +85,7 @@ class _WelcomeScreenState extends ConsumerState { final posInstance = ref.read(posClilentProvider); return Scaffold( backgroundColor: const Color(0xFF4CAF50), - appBar: DtcAppBar(showBackButton: false), + appBar: const DtcAppBar(showBackButton: false), body: SafeArea( child: Container( color: Colors.white, @@ -98,7 +98,7 @@ class _WelcomeScreenState extends ConsumerState { children: [ Text( 'Welcome to ${posInstance.reOwnSign!.metadata.name}', - style: TextStyle( + style: const TextStyle( color: Colors.black, fontSize: 32, fontWeight: FontWeight.bold, @@ -108,7 +108,7 @@ class _WelcomeScreenState extends ConsumerState { const SizedBox(height: 12), Text( posInstance.reOwnSign!.metadata.description, - style: TextStyle( + style: const TextStyle( color: Colors.grey, fontSize: 18, fontWeight: FontWeight.normal, @@ -117,10 +117,10 @@ class _WelcomeScreenState extends ConsumerState { ), const SizedBox(height: 40), // Merchant Information Card - DtcCard( + const DtcCard( child: Column( children: [ - const Text( + Text( "Mario's Italian Restaurant", style: TextStyle( color: Colors.black, @@ -129,8 +129,8 @@ class _WelcomeScreenState extends ConsumerState { ), textAlign: TextAlign.center, ), - const SizedBox(height: 8), - const Text( + SizedBox(height: 8), + Text( 'Ready to accept crypto payments', style: TextStyle( color: Colors.grey, @@ -158,7 +158,7 @@ class _WelcomeScreenState extends ConsumerState { elevation: 0, ), child: (_initializing) - ? Center( + ? const Center( child: CircularProgressIndicator( color: Colors.white, ), @@ -191,7 +191,7 @@ class _WelcomeScreenState extends ConsumerState { ), ), ), - bottomNavigationBar: DtcFooter(), + bottomNavigationBar: const DtcFooter(), ); } } diff --git a/packages/pos_client/example/lib/widgets/dtc_header.dart b/packages/pos_client/example/lib/widgets/dtc_header.dart index f0021912..71932558 100644 --- a/packages/pos_client/example/lib/widgets/dtc_header.dart +++ b/packages/pos_client/example/lib/widgets/dtc_header.dart @@ -11,7 +11,7 @@ class DtcHeader extends StatelessWidget { children: [ Text( title, - style: TextStyle( + style: const TextStyle( color: Colors.black, fontSize: 32, fontWeight: FontWeight.bold, @@ -21,7 +21,7 @@ class DtcHeader extends StatelessWidget { const SizedBox(height: 12), Text( description, - style: TextStyle( + style: const TextStyle( color: Colors.black, fontSize: 18, fontWeight: FontWeight.normal, diff --git a/packages/pos_client/example/pubspec.yaml b/packages/pos_client/example/pubspec.yaml index 71c1a400..3efe92e5 100644 --- a/packages/pos_client/example/pubspec.yaml +++ b/packages/pos_client/example/pubspec.yaml @@ -10,19 +10,18 @@ environment: dependencies: collection: ^1.19.1 + cupertino_icons: ^1.0.8 flutter: sdk: flutter flutter_riverpod: ^2.6.1 - cupertino_icons: ^1.0.8 - shared_preferences: ^2.2.2 pos_client: path: ../ + shared_preferences: ^2.2.2 dev_dependencies: + flutter_lints: ^5.0.0 flutter_test: sdk: flutter - flutter_lints: ^5.0.0 - flutter: uses-material-design: true diff --git a/packages/pos_client/lib/pos_client_impl.dart b/packages/pos_client/lib/pos_client_impl.dart index 065dac91..c9b7a024 100644 --- a/packages/pos_client/lib/pos_client_impl.dart +++ b/packages/pos_client/lib/pos_client_impl.dart @@ -234,7 +234,7 @@ class PosClient with PosRpcService, ValidatorService implements IPosClient { await _expirePreviousPairings(); if (_connectResponse?.session.isCompleted == false) { _connectResponse!.session.completeError( - ReownCoreError(code: 5090, message: 'ABORTED'), + const ReownCoreError(code: 5090, message: 'ABORTED'), ); } if (reinit) { @@ -418,7 +418,7 @@ extension _PrivateMembers on PosClient { for (var session in reOwnSign!.sessions.getAll()) { await reOwnSign!.disconnectSession( topic: session.topic, - reason: ReownSignError(code: 6000, message: 'POS disconnected'), + reason: const ReownSignError(code: 6000, message: 'POS disconnected'), ); } for (var pairing in reOwnSign!.pairings.getAll()) { @@ -530,7 +530,7 @@ extension _PrivateMembers on PosClient { _reOwnCore!.logger.d('[$runtimeType] disconnecting session'); await reOwnSign!.disconnectSession( topic: topic, - reason: ReownSignError(code: 6000, message: 'POS disconnected'), + reason: const ReownSignError(code: 6000, message: 'POS disconnected'), ); } } diff --git a/packages/pos_client/lib/services/validator_service.dart b/packages/pos_client/lib/services/validator_service.dart index 68a3c71b..e57de314 100644 --- a/packages/pos_client/lib/services/validator_service.dart +++ b/packages/pos_client/lib/services/validator_service.dart @@ -32,7 +32,7 @@ mixin ValidatorService implements IValidatorService { final senderAddress = approvedSession.getSenderCaip10Account(chainId); if (senderAddress == null) { - throw StateError("No matching account found for chain $chainId"); + throw StateError('No matching account found for chain $chainId'); } final methods = NamespaceUtils.getNamespacesMethodsForChainId( diff --git a/packages/pos_client/pubspec.yaml b/packages/pos_client/pubspec.yaml index 5dfa9875..1e3b2f27 100644 --- a/packages/pos_client/pubspec.yaml +++ b/packages/pos_client/pubspec.yaml @@ -17,8 +17,10 @@ dependencies: http: ^1.5.0 json_annotation: ^4.9.0 qr_flutter_wc: ^0.0.3 - reown_core: ^1.3.8 - reown_sign: ^1.3.9 + reown_core: + path: ../reown_core/ + reown_sign: + path: ../reown_sign/ dev_dependencies: build_runner: ^2.4.13 diff --git a/packages/pos_client/test/blockchain_service_test.dart b/packages/pos_client/test/blockchain_service_test.dart index 565ac6d5..b1399f8d 100644 --- a/packages/pos_client/test/blockchain_service_test.dart +++ b/packages/pos_client/test/blockchain_service_test.dart @@ -32,7 +32,7 @@ void main() { final testPosClient = TestPosClient( projectId: '123456789', deviceId: '987654321', - metadata: Metadata( + metadata: const Metadata( merchantName: 'Test', description: 'Test', url: 'url', @@ -44,13 +44,13 @@ void main() { ); final tokens = [ - PosToken( + const PosToken( network: PosNetwork(name: 'Ethereum', chainId: 'eip155:1'), symbol: 'USDC', standard: 'erc20', address: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', ), - PosToken( + const PosToken( network: PosNetwork( name: 'Solana', chainId: 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp', @@ -71,7 +71,7 @@ void main() { final testPosClient = TestPosClient( projectId: '123456789', deviceId: '987654321', - metadata: Metadata( + metadata: const Metadata( merchantName: 'Test', description: 'Test', url: 'url', @@ -92,20 +92,20 @@ void main() { final response = JsonRpcResponse.fromJson({ 'id': 1, 'result': { - "namespaces": [ + 'namespaces': [ { - "assetNamespaces": ["token", "slip44"], - "capabilities": null, - "events": [], - "methods": ["solana_signAndSendTransaction"], - "name": "solana", + 'assetNamespaces': ['token', 'slip44'], + 'capabilities': null, + 'events': [], + 'methods': ['solana_signAndSendTransaction'], + 'name': 'solana', }, { - "assetNamespaces": ["trc20", "slip44"], - "capabilities": null, - "events": [], - "methods": ["tron_signTransaction"], - "name": "tron", + 'assetNamespaces': ['trc20', 'slip44'], + 'capabilities': null, + 'events': [], + 'methods': ['tron_signTransaction'], + 'name': 'tron', }, ], }, @@ -120,7 +120,7 @@ void main() { final testPosClient = TestPosClient( projectId: '123456789', deviceId: '987654321', - metadata: Metadata( + metadata: const Metadata( merchantName: 'Test', description: 'Test', url: 'url', @@ -131,7 +131,7 @@ void main() { sign: mockSign, ); - final queryParams = QueryParams( + final queryParams = const QueryParams( projectId: '123456789', deviceId: '987654321', st: 'test_st', diff --git a/packages/pos_client/test/error_test.dart b/packages/pos_client/test/error_test.dart index 36a36848..61102654 100644 --- a/packages/pos_client/test/error_test.dart +++ b/packages/pos_client/test/error_test.dart @@ -5,42 +5,42 @@ import 'package:pos_client/utils/errors.dart'; void main() { group('EVM JsonRpcError parsing', () { final evmErrors = [ - JsonRpcError( + const JsonRpcError( code: -9, message: 'wc_pos_buildTransactions: Validation error: Failed to estimate gas: server returned an error response: error code -32000: insufficient funds for transfer', ), - JsonRpcError( + const JsonRpcError( code: -9, message: 'wc_pos_buildTransactions: Validation error: Failed to estimate gas: server returned an error response: error code 3: execution reverted: ERC20: transfer amount exceeds balance, data: "0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002645524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e63650000000000000000000000000000000000000000000000000000"', ), - JsonRpcError( + const JsonRpcError( code: -9, message: 'wc_pos_buildTransactions: Validation error: Invalid Recipient: Address format is not supported: 0x.........', ), - JsonRpcError( + const JsonRpcError( code: -9, message: 'wc_pos_buildTransactions: Validation error: Unable to parse amount with 6 decimals: digit 10 is out of range for base 10', ), - JsonRpcError( + const JsonRpcError( code: -9, message: 'wc_pos_buildTransactions: Validation error: Invalid Asset: Address format is not supported: ssssss', ), - JsonRpcError( + const JsonRpcError( code: -9, message: 'wc_pos_buildTransactions: Validation error: Invalid Sender: Wrong CAIP-10 format: sender', ), - JsonRpcError( + const JsonRpcError( code: -9, message: 'wc_pos_buildTransactions: Validation error: Failed to estimate gas: server returned an error response: error code -32000: asdasdasdas', ), - JsonRpcError( + const JsonRpcError( code: -9, message: 'wc_pos_buildTransactions: Validation error: Failed to estimate gas: server returned an error response: error code 3: execution reverted: ERC20: data: "0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002645524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e63650000000000000000000000000000000000000000000000000000"', @@ -81,27 +81,27 @@ void main() { group('Solana JsonRpcError parsing', () { final solanaErrors = [ - JsonRpcError( + const JsonRpcError( code: -9, message: 'wc_pos_buildTransactions: Validation error: Invalid Recipient: Wrong CAIP-10 format: intent.caip10Recipient', ), - JsonRpcError( + const JsonRpcError( code: -9, message: 'wc_pos_buildTransactions: Validation error: Unable to parse amount with 6 decimals: digit 18 is out of range for base 10', ), - JsonRpcError( + const JsonRpcError( code: -9, message: 'wc_pos_buildTransactions: Validation error: Invalid token mint address: String is the wrong size', ), - JsonRpcError( + const JsonRpcError( code: -9, message: 'wc_pos_buildTransactions: Validation error: Invalid Sender: Wrong CAIP-10 format: sender', ), - JsonRpcError( + const JsonRpcError( code: -9, message: 'wc_pos_buildTransactions: Validation error: Invalid mint account owner: 11111111111111111111111111111111. Expected SPL Token program.', @@ -133,7 +133,7 @@ void main() { group('Tron JsonRpcError parsing', () { final solanaErrors = [ - JsonRpcError( + const JsonRpcError( code: -10, message: 'wc_pos_checkTransaction: Validation error: Internal error: Broadcast failed: SIGERROR 56616c6964617465207369676e6174757265206572726f723a205369676e61747572652073697a65206973203634', @@ -154,105 +154,105 @@ void main() { group('codes JsonRpcError parsing', () { final List> evmErrors = [ { - JsonRpcError( + const JsonRpcError( code: -18901, message: 'wc_pos_buildTransactions: Validation error: asiuys adsga diuasg do saodsaugdas', ): PosApiError.invalidAsset, }, { - JsonRpcError( + const JsonRpcError( code: -18902, message: 'wc_pos_buildTransactions: Validation error: asiuys adsga diuasg do saodsaugdas', ): PosApiError.invalidRecipient, }, { - JsonRpcError( + const JsonRpcError( code: -18903, message: 'wc_pos_buildTransactions: Validation error: asiuys adsga diuasg do saodsaugdas', ): PosApiError.invalidSender, }, { - JsonRpcError( + const JsonRpcError( code: -18904, message: 'wc_pos_buildTransactions: Validation error: asiuys adsga diuasg do saodsaugdas', ): PosApiError.invalidAmount, }, { - JsonRpcError( + const JsonRpcError( code: -18905, message: 'wc_pos_buildTransactions: Validation error: asiuys adsga diuasg do saodsaugdas', ): PosApiError.invalidAddress, }, { - JsonRpcError( + const JsonRpcError( code: -18906, message: 'wc_pos_buildTransactions: Validation error: asiuys adsga diuasg do saodsaugdas', ): PosApiError.invalidWalletResponse, }, { - JsonRpcError( + const JsonRpcError( code: -18907, message: 'wc_pos_buildTransactions: Validation error: asiuys adsga diuasg do saodsaugdas', ): PosApiError.invalidTransactionId, }, { - JsonRpcError( + const JsonRpcError( code: -18920, message: 'wc_pos_buildTransactions: Validation error: Failed to estimate gas: server returned an error response: error code -32000: insufficient funds for transfer', ): PosApiError.insufficientFundsForTransfer, }, { - JsonRpcError( + const JsonRpcError( code: -18920, message: 'wc_pos_buildTransactions: Validation error: Failed to estimate gas: server returned an error response: error code 3: execution reverted: ERC20: transfer amount exceeds balance, data: "0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002645524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e63650000000000000000000000000000000000000000000000000000"', ): PosApiError.transferAmountExceedsBalance, }, { - JsonRpcError( + const JsonRpcError( code: -18920, message: 'wc_pos_buildTransactions: Validation error: asiuys adsga diuasg do saodsaugdas', ): PosApiError.failedToEstimateGas, }, { - JsonRpcError( + const JsonRpcError( code: -18940, message: 'wc_pos_buildTransactions: Validation error: asiuys adsga diuasg do saodsaugdas', ): PosApiError.invalidProviderUrl, }, { - JsonRpcError( + const JsonRpcError( code: -18941, message: 'wc_pos_buildTransactions: Validation error: Failed to estimate gas: server returned an error response', ): PosApiError.failedToEstimateGas, }, { - JsonRpcError( + const JsonRpcError( code: -18942, message: 'wc_pos_buildTransactions: Validation error: asiuys adsga diuasg do saodsaugdas', ): PosApiError.unknown, }, { - JsonRpcError( + const JsonRpcError( code: -18970, message: 'wc_pos_buildTransactions: Validation error: asiuys adsga diuasg do saodsaugdas', ): PosApiError.invalidFormat, }, { - JsonRpcError( + const JsonRpcError( code: -18971, message: 'wc_pos_buildTransactions: Validation error: asiuys adsga diuasg do saodsaugdas', diff --git a/packages/pos_client/test/result_models_test.dart b/packages/pos_client/test/result_models_test.dart index 589f9d3f..78ae6705 100644 --- a/packages/pos_client/test/result_models_test.dart +++ b/packages/pos_client/test/result_models_test.dart @@ -5,88 +5,88 @@ void main() { group('EvmTransactionParams', () { test('should parse from JSON correctly', () { final json = { - "data": - "0xa9059cbb000000000000000000000000d6d146ec0fa91c790737cfb4ee3d7e965a51c34000000000000000000000000000000000000000000000000000000000000f4240", - "from": "0xd6d146ec0fa91c790737cfb4ee3d7e965a51c340", - "gas": "0x9f03", - "input": - "0xa9059cbb000000000000000000000000d6d146ec0fa91c790737cfb4ee3d7e965a51c34000000000000000000000000000000000000000000000000000000000000f4240", - "maxFeePerGas": "0xfc200", - "maxPriorityFeePerGas": "0xf4414", - "to": "0x1c7d4b196cb0c7b01d743fbc6116a902379c7238", - "value": "0x0", + 'data': + '0xa9059cbb000000000000000000000000d6d146ec0fa91c790737cfb4ee3d7e965a51c34000000000000000000000000000000000000000000000000000000000000f4240', + 'from': '0xd6d146ec0fa91c790737cfb4ee3d7e965a51c340', + 'gas': '0x9f03', + 'input': + '0xa9059cbb000000000000000000000000d6d146ec0fa91c790737cfb4ee3d7e965a51c34000000000000000000000000000000000000000000000000000000000000f4240', + 'maxFeePerGas': '0xfc200', + 'maxPriorityFeePerGas': '0xf4414', + 'to': '0x1c7d4b196cb0c7b01d743fbc6116a902379c7238', + 'value': '0x0', }; final params = EvmTransactionParams.fromJson(json); - expect(params.from, "0xd6d146ec0fa91c790737cfb4ee3d7e965a51c340"); - expect(params.to, "0x1c7d4b196cb0c7b01d743fbc6116a902379c7238"); - expect(params.value, "0x0"); - expect(params.gas, "0x9f03"); + expect(params.from, '0xd6d146ec0fa91c790737cfb4ee3d7e965a51c340'); + expect(params.to, '0x1c7d4b196cb0c7b01d743fbc6116a902379c7238'); + expect(params.value, '0x0'); + expect(params.gas, '0x9f03'); expect( params.data, - "0xa9059cbb000000000000000000000000d6d146ec0fa91c790737cfb4ee3d7e965a51c34000000000000000000000000000000000000000000000000000000000000f4240", + '0xa9059cbb000000000000000000000000d6d146ec0fa91c790737cfb4ee3d7e965a51c34000000000000000000000000000000000000000000000000000000000000f4240', ); expect( params.input, - "0xa9059cbb000000000000000000000000d6d146ec0fa91c790737cfb4ee3d7e965a51c34000000000000000000000000000000000000000000000000000000000000f4240", + '0xa9059cbb000000000000000000000000d6d146ec0fa91c790737cfb4ee3d7e965a51c34000000000000000000000000000000000000000000000000000000000000f4240', ); - expect(params.maxFeePerGas, "0xfc200"); - expect(params.maxPriorityFeePerGas, "0xf4414"); + expect(params.maxFeePerGas, '0xfc200'); + expect(params.maxPriorityFeePerGas, '0xf4414'); }); test('should convert to JSON correctly', () { - final params = EvmTransactionParams( - from: "0xd6d146ec0fa91c790737cfb4ee3d7e965a51c340", - to: "0x1c7d4b196cb0c7b01d743fbc6116a902379c7238", - value: "0x0", - gas: "0x9f03", + final params = const EvmTransactionParams( + from: '0xd6d146ec0fa91c790737cfb4ee3d7e965a51c340', + to: '0x1c7d4b196cb0c7b01d743fbc6116a902379c7238', + value: '0x0', + gas: '0x9f03', data: - "0xa9059cbb000000000000000000000000d6d146ec0fa91c790737cfb4ee3d7e965a51c34000000000000000000000000000000000000000000000000000000000000f4240", + '0xa9059cbb000000000000000000000000d6d146ec0fa91c790737cfb4ee3d7e965a51c34000000000000000000000000000000000000000000000000000000000000f4240', input: - "0xa9059cbb000000000000000000000000d6d146ec0fa91c790737cfb4ee3d7e965a51c34000000000000000000000000000000000000000000000000000000000000f4240", - maxFeePerGas: "0xfc200", - maxPriorityFeePerGas: "0xf4414", + '0xa9059cbb000000000000000000000000d6d146ec0fa91c790737cfb4ee3d7e965a51c34000000000000000000000000000000000000000000000000000000000000f4240', + maxFeePerGas: '0xfc200', + maxPriorityFeePerGas: '0xf4414', ); final json = params.toJson(); - expect(json['from'], "0xd6d146ec0fa91c790737cfb4ee3d7e965a51c340"); - expect(json['to'], "0x1c7d4b196cb0c7b01d743fbc6116a902379c7238"); - expect(json['value'], "0x0"); - expect(json['gas'], "0x9f03"); + expect(json['from'], '0xd6d146ec0fa91c790737cfb4ee3d7e965a51c340'); + expect(json['to'], '0x1c7d4b196cb0c7b01d743fbc6116a902379c7238'); + expect(json['value'], '0x0'); + expect(json['gas'], '0x9f03'); expect( json['data'], - "0xa9059cbb000000000000000000000000d6d146ec0fa91c790737cfb4ee3d7e965a51c34000000000000000000000000000000000000000000000000000000000000f4240", + '0xa9059cbb000000000000000000000000d6d146ec0fa91c790737cfb4ee3d7e965a51c34000000000000000000000000000000000000000000000000000000000000f4240', ); expect( json['input'], - "0xa9059cbb000000000000000000000000d6d146ec0fa91c790737cfb4ee3d7e965a51c34000000000000000000000000000000000000000000000000000000000000f4240", + '0xa9059cbb000000000000000000000000d6d146ec0fa91c790737cfb4ee3d7e965a51c34000000000000000000000000000000000000000000000000000000000000f4240', ); - expect(json['maxFeePerGas'], "0xfc200"); - expect(json['maxPriorityFeePerGas'], "0xf4414"); + expect(json['maxFeePerGas'], '0xfc200'); + expect(json['maxPriorityFeePerGas'], '0xf4414'); }); }); group('TransactionRpc', () { test('should parse EVM transaction from JSON correctly', () { final json = { - "chainId": "eip155:11155111", - "id": - "djF8ZWlwMTU1OjExMTU1MTExfGNkNWZmYWQ0LTE2YTItNDY4ZC05N2E1LTMxNjEyY2Y4YWRmNQ", - "method": "eth_sendTransaction", - "params": [ + 'chainId': 'eip155:11155111', + 'id': + 'djF8ZWlwMTU1OjExMTU1MTExfGNkNWZmYWQ0LTE2YTItNDY4ZC05N2E1LTMxNjEyY2Y4YWRmNQ', + 'method': 'eth_sendTransaction', + 'params': [ { - "data": - "0xa9059cbb000000000000000000000000d6d146ec0fa91c790737cfb4ee3d7e965a51c34000000000000000000000000000000000000000000000000000000000000f4240", - "from": "0xd6d146ec0fa91c790737cfb4ee3d7e965a51c340", - "gas": "0x9f03", - "input": - "0xa9059cbb000000000000000000000000d6d146ec0fa91c790737cfb4ee3d7e965a51c34000000000000000000000000000000000000000000000000000000000000f4240", - "maxFeePerGas": "0xfc200", - "maxPriorityFeePerGas": "0xf4414", - "to": "0x1c7d4b196cb0c7b01d743fbc6116a902379c7238", - "value": "0x0", + 'data': + '0xa9059cbb000000000000000000000000d6d146ec0fa91c790737cfb4ee3d7e965a51c34000000000000000000000000000000000000000000000000000000000000f4240', + 'from': '0xd6d146ec0fa91c790737cfb4ee3d7e965a51c340', + 'gas': '0x9f03', + 'input': + '0xa9059cbb000000000000000000000000d6d146ec0fa91c790737cfb4ee3d7e965a51c34000000000000000000000000000000000000000000000000000000000000f4240', + 'maxFeePerGas': '0xfc200', + 'maxPriorityFeePerGas': '0xf4414', + 'to': '0x1c7d4b196cb0c7b01d743fbc6116a902379c7238', + 'value': '0x0', }, ], }; @@ -98,17 +98,17 @@ void main() { evm: (id, chainId, method, params) { expect( id, - "djF8ZWlwMTU1OjExMTU1MTExfGNkNWZmYWQ0LTE2YTItNDY4ZC05N2E1LTMxNjEyY2Y4YWRmNQ", + 'djF8ZWlwMTU1OjExMTU1MTExfGNkNWZmYWQ0LTE2YTItNDY4ZC05N2E1LTMxNjEyY2Y4YWRmNQ', ); - expect(method, "eth_sendTransaction"); - expect(chainId, "eip155:11155111"); + expect(method, 'eth_sendTransaction'); + expect(chainId, 'eip155:11155111'); expect(params.length, 1); expect( params.first.from, - "0xd6d146ec0fa91c790737cfb4ee3d7e965a51c340", + '0xd6d146ec0fa91c790737cfb4ee3d7e965a51c340', ); - expect(params.first.to, "0x1c7d4b196cb0c7b01d743fbc6116a902379c7238"); - expect(params.first.value, "0x0"); + expect(params.first.to, '0x1c7d4b196cb0c7b01d743fbc6116a902379c7238'); + expect(params.first.value, '0x0'); }, solana: (id, method, chainId, params) => fail('Expected EVM transaction'), @@ -118,12 +118,12 @@ void main() { test('should parse Solana transaction from JSON correctly', () { final json = { - "chainId": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp", - "id": "solana-tx-123", - "method": "solana_signAndSendTransaction", - "params": { - "transaction": "base64-encoded-transaction", - "pubkey": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM", + 'chainId': 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp', + 'id': 'solana-tx-123', + 'method': 'solana_signAndSendTransaction', + 'params': { + 'transaction': 'base64-encoded-transaction', + 'pubkey': '9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM', }, }; @@ -134,11 +134,11 @@ void main() { evm: (id, chainId, method, params) => fail('Expected Solana transaction'), solana: (id, chainId, method, params) { - expect(id, "solana-tx-123"); - expect(method, "solana_signAndSendTransaction"); - expect(chainId, "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"); - expect(params.transaction, "base64-encoded-transaction"); - expect(params.pubkey, "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM"); + expect(id, 'solana-tx-123'); + expect(method, 'solana_signAndSendTransaction'); + expect(chainId, 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp'); + expect(params.transaction, 'base64-encoded-transaction'); + expect(params.pubkey, '9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM'); }, tron: (id, chainId, method, params) => fail('Expected Solana transaction'), @@ -147,21 +147,21 @@ void main() { test('should parse Tron transaction from JSON correctly', () { final json = { - "chainId": "tron:0x2b6653dc", - "id": "tron-tx-456", - "method": "tron_signTransaction", - "params": { - "transaction": { - "result": {"result": true}, - "transaction": { - "raw_data": {"contract": []}, - "raw_data_hex": "0a02...", - "signature": ["abc123"], - "txID": "tron-tx-hash", - "visible": true, + 'chainId': 'tron:0x2b6653dc', + 'id': 'tron-tx-456', + 'method': 'tron_signTransaction', + 'params': { + 'transaction': { + 'result': {'result': true}, + 'transaction': { + 'raw_data': {'contract': []}, + 'raw_data_hex': '0a02...', + 'signature': ['abc123'], + 'txID': 'tron-tx-hash', + 'visible': true, }, }, - "address": "TLyqzVGLV1srkB7dToTAEqgDSfPtXRJZYH", + 'address': 'TLyqzVGLV1srkB7dToTAEqgDSfPtXRJZYH', }, }; @@ -173,22 +173,22 @@ void main() { solana: (id, chainId, method, params) => fail('Expected Tron transaction'), tron: (id, chainId, method, params) { - expect(id, "tron-tx-456"); - expect(method, "tron_signTransaction"); - expect(chainId, "tron:0x2b6653dc"); - expect(params.address, "TLyqzVGLV1srkB7dToTAEqgDSfPtXRJZYH"); + expect(id, 'tron-tx-456'); + expect(method, 'tron_signTransaction'); + expect(chainId, 'tron:0x2b6653dc'); + expect(params.address, 'TLyqzVGLV1srkB7dToTAEqgDSfPtXRJZYH'); expect(params.transaction.result.result, true); - expect(params.transaction.transaction.raw_data_hex, "0a02..."); + expect(params.transaction.transaction.raw_data_hex, '0a02...'); }, ); }); test('should throw error for unknown transaction type', () { final json = { - "chainId": "unknown:123", - "id": "unknown-tx", - "method": "unknown_method", - "params": {}, + 'chainId': 'unknown:123', + 'id': 'unknown-tx', + 'method': 'unknown_method', + 'params': {}, }; expect(() => TransactionRpc.fromJson(json), throwsA(isA())); @@ -198,24 +198,24 @@ void main() { group('BuildTransactionResult', () { test('should parse EVM transaction from JSON correctly', () { final json = { - "transactions": [ + 'transactions': [ { - "chainId": "eip155:11155111", - "id": - "djF8ZWlwMTU1OjExMTU1MTExfGNkNWZmYWQ0LTE2YTItNDY4ZC05N2E1LTMxNjEyY2Y4YWRmNQ", - "method": "eth_sendTransaction", - "params": [ + 'chainId': 'eip155:11155111', + 'id': + 'djF8ZWlwMTU1OjExMTU1MTExfGNkNWZmYWQ0LTE2YTItNDY4ZC05N2E1LTMxNjEyY2Y4YWRmNQ', + 'method': 'eth_sendTransaction', + 'params': [ { - "data": - "0xa9059cbb000000000000000000000000d6d146ec0fa91c790737cfb4ee3d7e965a51c34000000000000000000000000000000000000000000000000000000000000f4240", - "from": "0xd6d146ec0fa91c790737cfb4ee3d7e965a51c340", - "gas": "0x9f03", - "input": - "0xa9059cbb000000000000000000000000d6d146ec0fa91c790737cfb4ee3d7e965a51c34000000000000000000000000000000000000000000000000000000000000f4240", - "maxFeePerGas": "0xfc200", - "maxPriorityFeePerGas": "0xf4414", - "to": "0x1c7d4b196cb0c7b01d743fbc6116a902379c7238", - "value": "0x0", + 'data': + '0xa9059cbb000000000000000000000000d6d146ec0fa91c790737cfb4ee3d7e965a51c34000000000000000000000000000000000000000000000000000000000000f4240', + 'from': '0xd6d146ec0fa91c790737cfb4ee3d7e965a51c340', + 'gas': '0x9f03', + 'input': + '0xa9059cbb000000000000000000000000d6d146ec0fa91c790737cfb4ee3d7e965a51c34000000000000000000000000000000000000000000000000000000000000f4240', + 'maxFeePerGas': '0xfc200', + 'maxPriorityFeePerGas': '0xf4414', + 'to': '0x1c7d4b196cb0c7b01d743fbc6116a902379c7238', + 'value': '0x0', }, ], }, @@ -230,14 +230,14 @@ void main() { test('should parse Solana transaction from JSON correctly', () { final json = { - "transactions": [ + 'transactions': [ { - "chainId": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp", - "id": "solana-tx-123", - "method": "solana_signAndSendTransaction", - "params": { - "transaction": "base64-encoded-transaction", - "pubkey": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM", + 'chainId': 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp', + 'id': 'solana-tx-123', + 'method': 'solana_signAndSendTransaction', + 'params': { + 'transaction': 'base64-encoded-transaction', + 'pubkey': '9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM', }, }, ], @@ -251,23 +251,23 @@ void main() { test('should parse Tron transaction from JSON correctly', () { final json = { - "transactions": [ + 'transactions': [ { - "chainId": "tron:0x2b6653dc", - "id": "tron-tx-456", - "method": "tron_signTransaction", - "params": { - "transaction": { - "result": {"result": true}, - "transaction": { - "raw_data": {"contract": []}, - "raw_data_hex": "0a02...", - "signature": ["abc123"], - "txID": "tron-tx-hash", - "visible": true, + 'chainId': 'tron:0x2b6653dc', + 'id': 'tron-tx-456', + 'method': 'tron_signTransaction', + 'params': { + 'transaction': { + 'result': {'result': true}, + 'transaction': { + 'raw_data': {'contract': []}, + 'raw_data_hex': '0a02...', + 'signature': ['abc123'], + 'txID': 'tron-tx-hash', + 'visible': true, }, }, - "address": "TLyqzVGLV1srkB7dToTAEqgDSfPtXRJZYH", + 'address': 'TLyqzVGLV1srkB7dToTAEqgDSfPtXRJZYH', }, }, ], @@ -281,22 +281,22 @@ void main() { test('should parse mixed transaction types from JSON correctly', () { final json = { - "transactions": [ + 'transactions': [ { - "chainId": "eip155:11155111", - "id": "evm-tx-1", - "method": "eth_sendTransaction", - "params": [ - {"from": "0x123", "to": "0x456", "value": "0x0"}, + 'chainId': 'eip155:11155111', + 'id': 'evm-tx-1', + 'method': 'eth_sendTransaction', + 'params': [ + {'from': '0x123', 'to': '0x456', 'value': '0x0'}, ], }, { - "chainId": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp", - "id": "solana-tx-2", - "method": "solana_signAndSendTransaction", - "params": { - "transaction": "base64-tx", - "pubkey": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM", + 'chainId': 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp', + 'id': 'solana-tx-2', + 'method': 'solana_signAndSendTransaction', + 'params': { + 'transaction': 'base64-tx', + 'pubkey': '9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM', }, }, ], @@ -310,14 +310,14 @@ void main() { }); test('should convert to JSON correctly', () { - final result = BuildTransactionResult( + final result = const BuildTransactionResult( transactions: [ TransactionRpc.evm( - id: "test-id", - chainId: "eip155:1", - method: "eth_sendTransaction", + id: 'test-id', + chainId: 'eip155:1', + method: 'eth_sendTransaction', params: [ - EvmTransactionParams(from: "0x123", to: "0x456", value: "0x0"), + EvmTransactionParams(from: '0x123', to: '0x456', value: '0x0'), ], ), ], diff --git a/packages/reown_appkit/analysis_options.yaml b/packages/reown_appkit/analysis_options.yaml index 3e16fe1d..43d8214d 100644 --- a/packages/reown_appkit/analysis_options.yaml +++ b/packages/reown_appkit/analysis_options.yaml @@ -30,6 +30,9 @@ linter: avoid_unnecessary_containers: true cancel_subscriptions: true public_member_api_docs: false + prefer_const_constructors: true + # prefer_const_literals_to_create_immutables: true + avoid_field_initializers_in_const_classes: true analyzer: exclude: diff --git a/packages/reown_appkit/example/base/analysis_options.yaml b/packages/reown_appkit/example/base/analysis_options.yaml index 61281ab8..a6fbfdfc 100644 --- a/packages/reown_appkit/example/base/analysis_options.yaml +++ b/packages/reown_appkit/example/base/analysis_options.yaml @@ -29,6 +29,9 @@ linter: sort_pub_dependencies: true avoid_unnecessary_containers: true cancel_subscriptions: true + prefer_const_constructors: true + # prefer_const_literals_to_create_immutables: true + avoid_field_initializers_in_const_classes: true analyzer: exclude: diff --git a/packages/reown_appkit/example/base/ios/Podfile.lock b/packages/reown_appkit/example/base/ios/Podfile.lock index 8b56b7f6..2342ab7f 100644 --- a/packages/reown_appkit/example/base/ios/Podfile.lock +++ b/packages/reown_appkit/example/base/ios/Podfile.lock @@ -8,14 +8,11 @@ PODS: - Flutter (1.0.0) - flutter_secure_storage (6.0.0): - Flutter - - objective_c (0.0.1): - - Flutter DEPENDENCIES: - coinbase_wallet_sdk (from `.symlinks/plugins/coinbase_wallet_sdk/ios`) - Flutter (from `Flutter`) - flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`) - - objective_c (from `.symlinks/plugins/objective_c/ios`) SPEC REPOS: trunk: @@ -28,15 +25,12 @@ EXTERNAL SOURCES: :path: Flutter flutter_secure_storage: :path: ".symlinks/plugins/flutter_secure_storage/ios" - objective_c: - :path: ".symlinks/plugins/objective_c/ios" SPEC CHECKSUMS: coinbase_wallet_sdk: c893738400ef78bd20e7f4195cbb38266f7d15e8 CoinbaseWalletSDK: ea1f37512bbc69ebe07416e3b29bf840f5cc3152 Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467 flutter_secure_storage: 1ed9476fba7e7a782b22888f956cce43e2c62f13 - objective_c: 89e720c30d716b036faf9c9684022048eee1eee2 PODFILE CHECKSUM: 0772a2bd8cd4c7aaeb2576ddfaf6b03be722593b diff --git a/packages/reown_appkit/example/base/lib/main.dart b/packages/reown_appkit/example/base/lib/main.dart index 00e96289..97ac85d9 100644 --- a/packages/reown_appkit/example/base/lib/main.dart +++ b/packages/reown_appkit/example/base/lib/main.dart @@ -28,7 +28,7 @@ Future main() async { DeepLinkHandler.initListener(); if (kDebugMode) { - runApp(MyApp()); + runApp(const MyApp()); } else { // Catch Flutter framework errors FlutterError.onError = (FlutterErrorDetails details) { @@ -147,10 +147,12 @@ class _MyAppState extends State with WidgetsBindingObserver { theme: ThemeData( colorScheme: _isDarkMode ? ColorScheme.dark( - primary: ReownAppKitModalThemeData().darkColors.accent100, + primary: + const ReownAppKitModalThemeData().darkColors.accent100, ) : ColorScheme.light( - primary: ReownAppKitModalThemeData().lightColors.accent100, + primary: + const ReownAppKitModalThemeData().lightColors.accent100, ), ), home: MyHomePage( @@ -327,7 +329,7 @@ class _MyHomePageState extends State { // `getBalanceFallback` will be triggered if getting the balance from our blockchain API fails. You could place here your own getBalance method disconnectOnDispose: true, customWallets: [ - ReownAppKitModalWalletInfo( + const ReownAppKitModalWalletInfo( listing: AppKitModalWalletListing( id: '00001', name: 'Reown Web Sample', @@ -375,15 +377,15 @@ class _MyHomePageState extends State { context: context, builder: (BuildContext context) { return AlertDialog( - content: Text('App will be closed to apply changes'), + content: const Text('App will be closed to apply changes'), actions: [ TextButton( onPressed: () => Navigator.of(context).pop(false), - child: Text('Cancel'), + child: const Text('Cancel'), ), TextButton( onPressed: () => Navigator.of(context).pop(true), - child: Text('Ok'), + child: const Text('Ok'), ), ], ); @@ -519,7 +521,7 @@ class _MyHomePageState extends State { @override Widget build(BuildContext context) { if (_pageDatas.isEmpty) { - return Center(child: CircularProgressIndicator()); + return const Center(child: CircularProgressIndicator()); } final List navRail = []; if (MediaQuery.of(context).size.width >= Constants.smallScreen) { @@ -576,7 +578,7 @@ class _MyHomePageState extends State { return BottomNavigationBar( currentIndex: _selectedIndex, unselectedItemColor: Colors.grey, - selectedItemColor: Color(0xFF667DFF), + selectedItemColor: const Color(0xFF667DFF), showUnselectedLabels: true, type: BottomNavigationBarType.fixed, // called when one tab is selected @@ -713,7 +715,7 @@ class _MyHomePageState extends State { debugPrint('[ExampleApp] _onModalConnect ${event?.session.toJson()}'); setState(() {}); ScaffoldMessenger.of(context).showSnackBar( - SnackBar( + const SnackBar( content: Text('AppKit is connected'), duration: Duration(seconds: 2), ), @@ -749,7 +751,7 @@ class _MyHomePageState extends State { content: Text( event?.message ?? event?.description ?? 'An error occurred', ), - duration: Duration(seconds: 2), + duration: const Duration(seconds: 2), ), ); } diff --git a/packages/reown_appkit/example/base/lib/main_dwe.dart b/packages/reown_appkit/example/base/lib/main_dwe.dart index 1e1da8bc..1dc6b46e 100644 --- a/packages/reown_appkit/example/base/lib/main_dwe.dart +++ b/packages/reown_appkit/example/base/lib/main_dwe.dart @@ -11,7 +11,7 @@ import 'package:reown_appkit_dapp/utils/dart_defines.dart'; Future main() async { WidgetsFlutterBinding.ensureInitialized(); - runApp(MyApp()); + runApp(const MyApp()); } class MyApp extends StatefulWidget { @@ -71,10 +71,12 @@ class _MyAppState extends State with WidgetsBindingObserver { theme: ThemeData( colorScheme: _isDarkMode ? ColorScheme.dark( - primary: ReownAppKitModalThemeData().darkColors.accent100, + primary: + const ReownAppKitModalThemeData().darkColors.accent100, ) : ColorScheme.light( - primary: ReownAppKitModalThemeData().lightColors.accent100, + primary: + const ReownAppKitModalThemeData().lightColors.accent100, ), ), home: const MyHomePage(title: 'Kast DwE Demo'), @@ -165,7 +167,7 @@ class _MyHomePageState extends State { Text('Chain: ${_appKitModal.selectedChain?.chainId}'), ], ) - : CircularProgressIndicator(), + : const CircularProgressIndicator(), ), ); } @@ -230,13 +232,13 @@ class _KastMockedModalState extends State widget.appKitModal.disconnect(); Navigator.of(context).pop(); }, - child: Text('Disconnect wallet'), + child: const Text('Disconnect wallet'), ), TextButton( onPressed: () { Navigator.of(context).pop(); }, - child: Text('Close'), + child: const Text('Close'), ), ], ); @@ -312,7 +314,7 @@ class _KastMockedModalState extends State onPressed: () { Navigator.of(context).pop(); }, - child: Text('Close'), + child: const Text('Close'), ), ], ); @@ -411,7 +413,7 @@ class _KastMockedModalState extends State // OPEN MODAL // widget.appKitModal.openDepositView(); await widget.appKitModal.openModalView( - ReownAppKitModalDepositScreen(titleOverride: 'Deposit on Kast'), + const ReownAppKitModalDepositScreen(titleOverride: 'Deposit on Kast'), ); await widget.appKitModal.selectChain(null); } catch (e) { @@ -609,7 +611,7 @@ class _KastMockedModalState extends State return Container( decoration: BoxDecoration( color: themeColors.background125, - borderRadius: BorderRadius.vertical(top: Radius.circular(40.0)), + borderRadius: const BorderRadius.vertical(top: Radius.circular(40.0)), border: Border(top: BorderSide(color: themeColors.background150)), ), child: SafeArea( @@ -647,7 +649,7 @@ class _KastMockedModalState extends State fontWeight: FontWeight.w600, ), ), - Spacer(), + const Spacer(), IconButton( icon: Icon( Icons.close_rounded, @@ -771,7 +773,7 @@ mixin StatusCheckUtils { if (status == 'PENDING') { if (count > 0) { // retry - await Future.delayed(Duration(seconds: 1)); + await Future.delayed(const Duration(seconds: 1)); return checkTxStatus(appKitModal, chainId, txHash, count, callback); } diff --git a/packages/reown_appkit/example/base/lib/pages/connect_page.dart b/packages/reown_appkit/example/base/lib/pages/connect_page.dart index 3990bf21..eef13be2 100644 --- a/packages/reown_appkit/example/base/lib/pages/connect_page.dart +++ b/packages/reown_appkit/example/base/lib/pages/connect_page.dart @@ -281,7 +281,7 @@ class __RequestButtonsState extends State<_RequestButtons> { final topic = widget.appKitModal.session!.topic ?? ''; final chainId = widget.appKitModal.selectedChain?.chainId ?? ''; if (chainId.isEmpty) { - return SizedBox.shrink(); + return const SizedBox.shrink(); } final namespace = NamespaceUtils.getNamespaceFromChain(chainId); final approvedMethods = widget.appKitModal.getApprovedMethods( @@ -340,7 +340,7 @@ class __RequestButtonsState extends State<_RequestButtons> { .map( (method) => PrimaryButton( title: method, - borderRadius: BorderRadius.all(Radius.circular(30.0)), + borderRadius: const BorderRadius.all(Radius.circular(30.0)), buttonSize: BaseButtonSize.regular, onTap: () async { // Uncomment to sign and submit real transaction @@ -383,7 +383,7 @@ class __RequestButtonsState extends State<_RequestButtons> { type: ToastificationType.error, title: const Text('Method not implemented'), context: context, - autoCloseDuration: Duration(seconds: 2), + autoCloseDuration: const Duration(seconds: 2), alignment: Alignment.bottomCenter, ); } @@ -409,17 +409,17 @@ class __SmartAccountButtonsState extends State<_SmartAccountButtons> { Widget build(BuildContext context) { final chainId = widget.appKitModal.selectedChain?.chainId ?? ''; if (chainId.isEmpty) { - return SizedBox.shrink(); + return const SizedBox.shrink(); } final namespace = NamespaceUtils.getNamespaceFromChain(chainId); if (namespace != 'eip155') { - return SizedBox.shrink(); + return const SizedBox.shrink(); } return FutureBuilder( future: contractCallsButton(widget.appKitModal, context), builder: (context, snapshot) { - return snapshot.data ?? SizedBox.shrink(); + return snapshot.data ?? const SizedBox.shrink(); }, ); } diff --git a/packages/reown_appkit/example/base/lib/pages/pairings_page.dart b/packages/reown_appkit/example/base/lib/pages/pairings_page.dart index bbd03275..32c90776 100644 --- a/packages/reown_appkit/example/base/lib/pages/pairings_page.dart +++ b/packages/reown_appkit/example/base/lib/pages/pairings_page.dart @@ -37,7 +37,7 @@ class PairingsPageState extends State { @override Widget build(BuildContext context) { if (_pairings.isEmpty) { - return Center(child: Text('No relay pairings')); + return const Center(child: Text('No relay pairings')); } final List pairingItems = _pairings .map( diff --git a/packages/reown_appkit/example/base/lib/pages/settings_page.dart b/packages/reown_appkit/example/base/lib/pages/settings_page.dart index 6cc07a55..6680aa81 100644 --- a/packages/reown_appkit/example/base/lib/pages/settings_page.dart +++ b/packages/reown_appkit/example/base/lib/pages/settings_page.dart @@ -224,7 +224,7 @@ class SettingsPageState extends State { await widget.appKitModal.appKit!.core.storage .deleteAll(); ScaffoldMessenger.of(context).showSnackBar( - SnackBar( + const SnackBar( content: Text('Storage cleared'), duration: Duration(seconds: 1), ), diff --git a/packages/reown_appkit/example/base/lib/utils/crypto/helpers.dart b/packages/reown_appkit/example/base/lib/utils/crypto/helpers.dart index 225bc0d5..f826361c 100644 --- a/packages/reown_appkit/example/base/lib/utils/crypto/helpers.dart +++ b/packages/reown_appkit/example/base/lib/utils/crypto/helpers.dart @@ -309,12 +309,12 @@ Future contractCallsButton( contract = PolygonBONSAIContract(); future = _approveSend(appKitModal, contract); } else { - return SizedBox.shrink(); + return const SizedBox.shrink(); } return Column( children: [ - Text( + const Text( 'Smart Contract interaction', style: TextStyle(fontWeight: FontWeight.bold), ), @@ -335,7 +335,7 @@ Future contractCallsButton( ), PrimaryButton( title: title, - borderRadius: BorderRadius.all(Radius.circular(30.0)), + borderRadius: const BorderRadius.all(Radius.circular(30.0)), buttonSize: BaseButtonSize.regular, onTap: () { MethodDialog.show(context, title, future.call()); diff --git a/packages/reown_appkit/example/base/lib/widgets/method_dialog.dart b/packages/reown_appkit/example/base/lib/widgets/method_dialog.dart index d4c62e27..7958870d 100644 --- a/packages/reown_appkit/example/base/lib/widgets/method_dialog.dart +++ b/packages/reown_appkit/example/base/lib/widgets/method_dialog.dart @@ -61,7 +61,7 @@ class MethodDialogState extends State { (_) => toastification.show( title: const Text(StringConstants.copiedToClipboard), context: context, - autoCloseDuration: Duration(seconds: 2), + autoCloseDuration: const Duration(seconds: 2), alignment: Alignment.bottomCenter, ), ); @@ -78,7 +78,7 @@ class MethodDialogState extends State { (_) => toastification.show( title: const Text(StringConstants.copiedToClipboard), context: context, - autoCloseDuration: Duration(seconds: 2), + autoCloseDuration: const Duration(seconds: 2), alignment: Alignment.bottomCenter, ), ); diff --git a/packages/reown_appkit/example/modal/analysis_options.yaml b/packages/reown_appkit/example/modal/analysis_options.yaml index b677fc6a..ac988f21 100644 --- a/packages/reown_appkit/example/modal/analysis_options.yaml +++ b/packages/reown_appkit/example/modal/analysis_options.yaml @@ -29,6 +29,9 @@ linter: sort_pub_dependencies: true avoid_unnecessary_containers: true cancel_subscriptions: true + prefer_const_constructors: true + # prefer_const_literals_to_create_immutables: true + avoid_field_initializers_in_const_classes: true analyzer: exclude: diff --git a/packages/reown_appkit/example/modal/lib/home_page.dart b/packages/reown_appkit/example/modal/lib/home_page.dart index c4a2c159..db389369 100644 --- a/packages/reown_appkit/example/modal/lib/home_page.dart +++ b/packages/reown_appkit/example/modal/lib/home_page.dart @@ -230,7 +230,7 @@ class _MyHomePageState extends State { // ReownAppKitModalNetworks.removeTestNetworks(); ReownAppKitModalNetworks.addSupportedNetworks('eip155', [ - ReownAppKitModalNetworkInfo( + const ReownAppKitModalNetworkInfo( name: 'Base Sepolia', chainId: '84531', currency: 'SEP', @@ -245,7 +245,7 @@ class _MyHomePageState extends State { } else { // Add custom chains ReownAppKitModalNetworks.addSupportedNetworks('polkadot', [ - ReownAppKitModalNetworkInfo( + const ReownAppKitModalNetworkInfo( name: 'Polkadot', chainId: '91b171bb158e2d3848fa23a9f1c25182', chainIcon: 'https://cryptologos.cc/logos/polkadot-new-dot-logo.png', @@ -253,7 +253,7 @@ class _MyHomePageState extends State { rpcUrl: 'https://rpc.polkadot.io', explorerUrl: 'https://polkadot.subscan.io', ), - ReownAppKitModalNetworkInfo( + const ReownAppKitModalNetworkInfo( name: 'Westend', chainId: 'e143f23803ac50e8f6f8e62695d1ce9e', currency: 'DOT', @@ -469,9 +469,9 @@ class _MyHomePageState extends State { void _onRelayClientConnect(EventArgs? event) { setState(() {}); toastification.show( - title: Text('Relay connected'), + title: const Text('Relay connected'), context: context, - autoCloseDuration: Duration(seconds: 2), + autoCloseDuration: const Duration(seconds: 2), alignment: Alignment.bottomCenter, ); } @@ -481,7 +481,7 @@ class _MyHomePageState extends State { toastification.show( title: Text('Relay error: ${event?.error}'), context: context, - autoCloseDuration: Duration(seconds: 2), + autoCloseDuration: const Duration(seconds: 2), alignment: Alignment.bottomCenter, ); } @@ -491,7 +491,7 @@ class _MyHomePageState extends State { toastification.show( title: Text('Relay disconnected: ${event?.toString()}'), context: context, - autoCloseDuration: Duration(seconds: 2), + autoCloseDuration: const Duration(seconds: 2), alignment: Alignment.bottomCenter, ); } @@ -499,7 +499,7 @@ class _MyHomePageState extends State { @override Widget build(BuildContext context) { if (!_initialized) { - return SizedBox.shrink(); + return const SizedBox.shrink(); } return Scaffold( backgroundColor: ReownAppKitModalTheme.colorsOf(context).background125, @@ -596,7 +596,7 @@ class _ButtonsView extends StatelessWidget { // appKit.openModalView(ReownAppKitModalQRCodePage()); // appKit.openModalView(ReownAppKitModalSelectNetworkPage()); // appKit.openModalView(ReownAppKitModalAllWalletsPage()); - appKit.openModalView(ReownAppKitModalMainWalletsPage()); + appKit.openModalView(const ReownAppKitModalMainWalletsPage()); }, child: appKit.isConnected ? Text( diff --git a/packages/reown_appkit/example/modal/lib/widgets/method_dialog.dart b/packages/reown_appkit/example/modal/lib/widgets/method_dialog.dart index 68892bf5..f8e5b30c 100644 --- a/packages/reown_appkit/example/modal/lib/widgets/method_dialog.dart +++ b/packages/reown_appkit/example/modal/lib/widgets/method_dialog.dart @@ -68,9 +68,9 @@ class MethodDialogState extends State { void _copyToClipboard(String text) { Clipboard.setData(ClipboardData(text: text)).then( (_) => toastification.show( - title: Text(StringConstants.copiedToClipboard), + title: const Text(StringConstants.copiedToClipboard), context: context, - autoCloseDuration: Duration(seconds: 2), + autoCloseDuration: const Duration(seconds: 2), alignment: Alignment.bottomCenter, ), ); diff --git a/packages/reown_appkit/example/modal/lib/widgets/session_widget.dart b/packages/reown_appkit/example/modal/lib/widgets/session_widget.dart index 148b6b41..01fb560d 100644 --- a/packages/reown_appkit/example/modal/lib/widgets/session_widget.dart +++ b/packages/reown_appkit/example/modal/lib/widgets/session_widget.dart @@ -158,9 +158,9 @@ class SessionWidgetState extends State { ), ).then( (_) => toastification.show( - title: Text(StringConstants.copiedToClipboard), + title: const Text(StringConstants.copiedToClipboard), context: context, - autoCloseDuration: Duration(seconds: 2), + autoCloseDuration: const Duration(seconds: 2), alignment: Alignment.bottomCenter, ), ), diff --git a/packages/reown_appkit/lib/base/services/models/asset_models.dart b/packages/reown_appkit/lib/base/services/models/asset_models.dart index 0522b3e6..5d176157 100644 --- a/packages/reown_appkit/lib/base/services/models/asset_models.dart +++ b/packages/reown_appkit/lib/base/services/models/asset_models.dart @@ -5,11 +5,11 @@ part 'asset_models.g.dart'; part 'asset_models.freezed.dart'; final Map _chainAssetInfoMap = { - 'eip155': AssetInfo( + 'eip155': const AssetInfo( native: NativeInfo(namespace: 'slip44', reference: '60'), standard: 'erc20', ), - 'solana': AssetInfo( + 'solana': const AssetInfo( native: NativeInfo(namespace: 'slip44', reference: '501'), standard: 'token', ), diff --git a/packages/reown_appkit/lib/modal/appkit_modal_impl.dart b/packages/reown_appkit/lib/modal/appkit_modal_impl.dart index 8be249d7..737ced74 100644 --- a/packages/reown_appkit/lib/modal/appkit_modal_impl.dart +++ b/packages/reown_appkit/lib/modal/appkit_modal_impl.dart @@ -798,7 +798,7 @@ class ReownAppKitModal @override Future openDepositView() { - return _showModalView(startWidget: ReownAppKitModalDepositScreen()); + return _showModalView(startWidget: const ReownAppKitModalDepositScreen()); } @override @@ -916,13 +916,16 @@ class ReownAppKitModal barrierDismissible: false, useSafeArea: true, useRootNavigator: true, - anchorPoint: Offset(0, 0), + anchorPoint: const Offset(0, 0), context: _context!, builder: (_) { final radiuses = ReownAppKitModalTheme.radiusesOf(_context!); final maxRadius = min(radiuses.radiusM, 36.0); final borderRadius = BorderRadius.all(Radius.circular(maxRadius)); - final constraints = BoxConstraints(maxWidth: 360, maxHeight: 600); + final constraints = const BoxConstraints( + maxWidth: 360, + maxHeight: 600, + ); return Dialog( backgroundColor: ReownAppKitModalTheme.colorsOf( _context!, @@ -1352,7 +1355,7 @@ class ReownAppKitModal } if (_currentSession?.sessionService.isMagic == true) { try { - await Future.delayed(Duration(milliseconds: 300)); + await Future.delayed(const Duration(milliseconds: 300)); await _magicService.disconnect(); } catch (e) { _appKit.core.logger.d('[$runtimeType] disconnect magic $e'); @@ -1698,7 +1701,7 @@ class ReownAppKitModal GetIt.I.unregister(); GetIt.I.unregister(); GetIt.I.unregister(); - await Future.delayed(Duration(milliseconds: 500)); + await Future.delayed(const Duration(milliseconds: 500)); _notify(); } _isDisposed = true; @@ -1895,7 +1898,7 @@ class ReownAppKitModal if (_isUserRejectedError(e)) { // fallback to current chain if rejected by user await _setLocalEthChain(_selectedChainID!); - throw JsonRpcError(code: 5002, message: 'User rejected methods.'); + throw const JsonRpcError(code: 5002, message: 'User rejected methods.'); } else { try { // Otherwise it meas chain has to be added. @@ -2001,7 +2004,7 @@ class ReownAppKitModal _notify(); if (event) { - Future.delayed(Duration(milliseconds: 200), () { + Future.delayed(const Duration(milliseconds: 200), () { onModalDisconnect.broadcast( ModalDisconnect( topic: args?.topic ?? _currentSession?.topic, diff --git a/packages/reown_appkit/lib/modal/models/public/appkit_modal_session.dart b/packages/reown_appkit/lib/modal/models/public/appkit_modal_session.dart index b1dc31d6..b07ab544 100644 --- a/packages/reown_appkit/lib/modal/models/public/appkit_modal_session.dart +++ b/packages/reown_appkit/lib/modal/models/public/appkit_modal_session.dart @@ -385,7 +385,7 @@ extension ReownAppKitModalSessionExtension on ReownAppKitModalSession { } if (sessionService.isMagic) { return _magicData?.self ?? - ConnectionMetadata( + const ConnectionMetadata( publicKey: '', metadata: PairingMetadata( name: 'Email Wallet', @@ -410,7 +410,7 @@ extension ReownAppKitModalSessionExtension on ReownAppKitModalSession { } if (sessionService.isMagic) { return _magicData?.peer ?? - ConnectionMetadata( + const ConnectionMetadata( publicKey: '', metadata: PairingMetadata( name: 'Email Wallet', diff --git a/packages/reown_appkit/lib/modal/pages/account_page.dart b/packages/reown_appkit/lib/modal/pages/account_page.dart index 14adcd5e..d5b2c1df 100644 --- a/packages/reown_appkit/lib/modal/pages/account_page.dart +++ b/packages/reown_appkit/lib/modal/pages/account_page.dart @@ -66,10 +66,10 @@ class _AccountPageState extends State with WidgetsBindingObserver { @override Widget build(BuildContext context) { if (_appKitModal == null) { - return ContentLoading(viewHeight: 400.0); + return const ContentLoading(viewHeight: 400.0); } if (_appKitModal?.session == null) { - return ContentLoading(viewHeight: 400.0); + return const ContentLoading(viewHeight: 400.0); } return ModalNavbar( @@ -194,7 +194,7 @@ class _UpgradeWalletButton extends StatelessWidget { titleStyle: themeData.textStyles.paragraph500.copyWith( color: themeColors.foreground100, ), - onTap: () => _widgetStack.push(UpgradeWalletPage()), + onTap: () => _widgetStack.push(const UpgradeWalletPage()), ), ], ); @@ -214,7 +214,7 @@ class _EmailAndSocialLoginButton extends StatelessWidget { }); final title = modalInstance.session!.sessionUsername; if (provider == null) { - return SizedBox.shrink(); + return const SizedBox.shrink(); } return Column( children: [ @@ -359,7 +359,7 @@ class _SelectNetworkButton extends StatelessWidget { color: themeColors.foreground100, ), onTap: () => _widgetStack.push( - ReownAppKitModalSelectNetworkPage(), + const ReownAppKitModalSelectNetworkPage(), event: ClickNetworksEvent(), ), ), @@ -382,7 +382,7 @@ class _FundWalletButton extends StatelessWidget { padding: const EdgeInsets.symmetric(horizontal: 4.0), child: Container( decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(17.0)), + borderRadius: const BorderRadius.all(Radius.circular(17.0)), border: Border.fromBorderSide( BorderSide( color: themeColors.grayGlass002, @@ -404,7 +404,7 @@ class _FundWalletButton extends StatelessWidget { ), ), title: 'Fund wallet', - onTap: () => _widgetStack.push(ReownAppKitModalDepositScreen()), + onTap: () => _widgetStack.push(const ReownAppKitModalDepositScreen()), ), ], ); @@ -427,7 +427,7 @@ class _ActivityButton extends StatelessWidget { iconBGColor: themeColors.accenGlass015, iconBorderColor: themeColors.accenGlass005, title: 'Activity', - onTap: () => _widgetStack.push(ActivityPage()), + onTap: () => _widgetStack.push(const ActivityPage()), ), ], ); @@ -499,7 +499,7 @@ class _SwitchSmartAccountButtonState extends State<_SwitchSmartAccountButton> { color: themeColors.foreground100, ), trailing: _loading - ? Row( + ? const Row( children: [ CircularLoader(size: 18.0, strokeWidth: 2.0), SizedBox.square(dimension: kPadding12), @@ -546,7 +546,7 @@ class _DisconnectButton extends StatelessWidget { iconBGColor: themeColors.grayGlass010, iconBorderColor: themeColors.grayGlass005, trailing: service.status.isLoading - ? Row( + ? const Row( children: [ CircularLoader(size: 18.0, strokeWidth: 2.0), SizedBox.square(dimension: kPadding12), diff --git a/packages/reown_appkit/lib/modal/pages/activity_page.dart b/packages/reown_appkit/lib/modal/pages/activity_page.dart index 24e5601d..c77ae4eb 100644 --- a/packages/reown_appkit/lib/modal/pages/activity_page.dart +++ b/packages/reown_appkit/lib/modal/pages/activity_page.dart @@ -243,9 +243,9 @@ class _ActivityListViewBuilderState extends State { itemBuilder: (_, int index) { if (index == groupedActivities.length) { // Loading indicator - return Center( + return const Center( child: Padding( - padding: const EdgeInsets.all(8.0), + padding: EdgeInsets.all(8.0), child: CircularProgressIndicator.adaptive(), ), ); diff --git a/packages/reown_appkit/lib/modal/pages/approve_siwe.dart b/packages/reown_appkit/lib/modal/pages/approve_siwe.dart index 5d04deff..555394fd 100644 --- a/packages/reown_appkit/lib/modal/pages/approve_siwe.dart +++ b/packages/reown_appkit/lib/modal/pages/approve_siwe.dart @@ -44,7 +44,7 @@ class _ApproveSIWEPageState extends State { setState(() { _position = (MediaQuery.of(context).size.width / 2) + 8.0; _appKitModal = ModalProvider.of(context).instance; - Future.delayed(Duration(milliseconds: 200), () { + Future.delayed(const Duration(milliseconds: 200), () { _animate(); }); }); @@ -124,8 +124,8 @@ class _ApproveSIWEPageState extends State { @override Widget build(BuildContext context) { - if (_appKitModal == null) return ContentLoading(); - if (_appKitModal!.session == null) return ContentLoading(); + if (_appKitModal == null) return const ContentLoading(); + if (_appKitModal!.session == null) return const ContentLoading(); final themeData = ReownAppKitModalTheme.getDataOf(context); final themeColors = ReownAppKitModalTheme.colorsOf(context); diff --git a/packages/reown_appkit/lib/modal/pages/connect_wallet_page.dart b/packages/reown_appkit/lib/modal/pages/connect_wallet_page.dart index fff05bc6..f6137758 100644 --- a/packages/reown_appkit/lib/modal/pages/connect_wallet_page.dart +++ b/packages/reown_appkit/lib/modal/pages/connect_wallet_page.dart @@ -61,7 +61,7 @@ class _ConnectWalletPageState extends State final isOpen = _appkitModal?.isOpen ?? false; final isConnected = _appkitModal?.isConnected ?? false; if (isOpen && isConnected && !_siweService.enabled) { - Future.delayed(Duration(seconds: 1), () { + Future.delayed(const Duration(seconds: 1), () { if (!mounted) return; _appkitModal?.closeModal(); }); @@ -91,7 +91,7 @@ class _ConnectWalletPageState extends State @override Widget build(BuildContext context) { if (_appkitModal == null) { - return ContentLoading(); + return const ContentLoading(); } final themeData = ReownAppKitModalTheme.getDataOf(context); final themeColors = ReownAppKitModalTheme.colorsOf(context); @@ -190,7 +190,7 @@ class _ConnectWalletPageState extends State ), ) : nonInstalledMobile(errorEvent) - ? SizedBox.shrink() + ? const SizedBox.shrink() : Text( webOnlyWallet || _selectedSegment == SegmentOption.option2 @@ -339,7 +339,7 @@ class _WalletAvatar extends StatelessWidget { child: Container( decoration: BoxDecoration( color: themeColors.background125, - borderRadius: BorderRadius.all(Radius.circular(30.0)), + borderRadius: const BorderRadius.all(Radius.circular(30.0)), ), padding: const EdgeInsets.all(1.0), clipBehavior: Clip.antiAlias, diff --git a/packages/reown_appkit/lib/modal/pages/connet_network_page.dart b/packages/reown_appkit/lib/modal/pages/connet_network_page.dart index add11cb2..40236f91 100644 --- a/packages/reown_appkit/lib/modal/pages/connet_network_page.dart +++ b/packages/reown_appkit/lib/modal/pages/connet_network_page.dart @@ -124,7 +124,7 @@ class _ConnectNetworkPageState extends State @override Widget build(BuildContext context) { if (_appKitModal == null) { - return ContentLoading(); + return const ContentLoading(); } final themeData = ReownAppKitModalTheme.getDataOf(context); final themeColors = ReownAppKitModalTheme.colorsOf(context); @@ -233,7 +233,7 @@ class _WalletAvatar extends StatelessWidget { child: Container( decoration: BoxDecoration( color: themeColors.background125, - borderRadius: BorderRadius.all(Radius.circular(30.0)), + borderRadius: const BorderRadius.all(Radius.circular(30.0)), ), padding: const EdgeInsets.all(1.0), clipBehavior: Clip.antiAlias, diff --git a/packages/reown_appkit/lib/modal/pages/farcaster_qrcode_page.dart b/packages/reown_appkit/lib/modal/pages/farcaster_qrcode_page.dart index a24b709d..5be2f525 100644 --- a/packages/reown_appkit/lib/modal/pages/farcaster_qrcode_page.dart +++ b/packages/reown_appkit/lib/modal/pages/farcaster_qrcode_page.dart @@ -64,7 +64,7 @@ class _FarcasterQRCodePageState extends State { direction: isPortrait ? Axis.vertical : Axis.horizontal, children: [ Padding( - padding: EdgeInsets.all(20.0), + padding: const EdgeInsets.all(20.0), child: _qrQodeWidget ?? AspectRatio( @@ -104,9 +104,9 @@ class _FarcasterQRCodePageState extends State { padding: const EdgeInsets.symmetric(vertical: kPadding12), child: PrimaryButton( title: 'Open Farcaster', - color: Color(0xFF855DCD), + color: const Color(0xFF855DCD), borderRadius: (radiuses.isSquare() - ? BorderRadius.all(Radius.zero) + ? const BorderRadius.all(Radius.zero) : BorderRadius.circular( BaseButtonSize.big.height / 2, )), diff --git a/packages/reown_appkit/lib/modal/pages/preview_send/preview_send_evm.dart b/packages/reown_appkit/lib/modal/pages/preview_send/preview_send_evm.dart index 9675226f..184105cc 100644 --- a/packages/reown_appkit/lib/modal/pages/preview_send/preview_send_evm.dart +++ b/packages/reown_appkit/lib/modal/pages/preview_send/preview_send_evm.dart @@ -197,7 +197,7 @@ class _PreviewSendEvmState extends State { if (_isSendEnabled) { _gasEstimationTimer ??= Timer.periodic( - Duration(seconds: 10), + const Duration(seconds: 10), _reEstimateGas, ); } else { diff --git a/packages/reown_appkit/lib/modal/pages/preview_send/preview_send_solana.dart b/packages/reown_appkit/lib/modal/pages/preview_send/preview_send_solana.dart index ff3341b7..4b7a5084 100644 --- a/packages/reown_appkit/lib/modal/pages/preview_send/preview_send_solana.dart +++ b/packages/reown_appkit/lib/modal/pages/preview_send/preview_send_solana.dart @@ -191,7 +191,7 @@ class _PreviewSendSolanaState extends State { if (_isSendEnabled) { _gasEstimationTimer ??= Timer.periodic( - Duration(seconds: 10), + const Duration(seconds: 10), _reEstimateGas, ); } else { diff --git a/packages/reown_appkit/lib/modal/pages/preview_send/widgets.dart b/packages/reown_appkit/lib/modal/pages/preview_send/widgets.dart index 17e96ccb..96fc8c56 100644 --- a/packages/reown_appkit/lib/modal/pages/preview_send/widgets.dart +++ b/packages/reown_appkit/lib/modal/pages/preview_send/widgets.dart @@ -52,7 +52,7 @@ class SendRow extends StatelessWidget { ), ], ), - Expanded(child: SizedBox()), + const Expanded(child: SizedBox()), NetworkButton( serviceStatus: appKitModal.status, chainInfo: appKitModal.selectedChain, @@ -91,7 +91,7 @@ class ReceiveRow extends StatelessWidget { height: 1.2, ), ), - Expanded(child: SizedBox()), + const Expanded(child: SizedBox()), AddressButton( service: appKitModal, child: Row( diff --git a/packages/reown_appkit/lib/modal/pages/public/appkit_modal_all_wallets_page.dart b/packages/reown_appkit/lib/modal/pages/public/appkit_modal_all_wallets_page.dart index 1823bbb6..96261993 100644 --- a/packages/reown_appkit/lib/modal/pages/public/appkit_modal_all_wallets_page.dart +++ b/packages/reown_appkit/lib/modal/pages/public/appkit_modal_all_wallets_page.dart @@ -72,7 +72,7 @@ class _AppKitModalAllWalletsPageState title: 'All wallets', onTapTitle: () => _controller.animateTo( 0, - duration: Duration(milliseconds: 200), + duration: const Duration(milliseconds: 200), curve: Curves.linear, ), onBack: () { @@ -93,7 +93,9 @@ class _AppKitModalAllWalletsPageState ), child: Column( children: [ - isSearchAvailable ? const AllWalletsHeader() : SizedBox.shrink(), + isSearchAvailable + ? const AllWalletsHeader() + : const SizedBox.shrink(), Expanded( child: NotificationListener( onNotification: _processScrollNotification, diff --git a/packages/reown_appkit/lib/modal/pages/public/appkit_modal_main_wallets_page.dart b/packages/reown_appkit/lib/modal/pages/public/appkit_modal_main_wallets_page.dart index b4725dc8..6f0e50fe 100644 --- a/packages/reown_appkit/lib/modal/pages/public/appkit_modal_main_wallets_page.dart +++ b/packages/reown_appkit/lib/modal/pages/public/appkit_modal_main_wallets_page.dart @@ -140,7 +140,7 @@ class _AppKitModalMainWalletsPageState child: Padding( padding: const EdgeInsets.symmetric(horizontal: 4.0), child: Column( - children: [SocialLoginButtonsView(), _LoginDivider()], + children: [const SocialLoginButtonsView(), _LoginDivider()], ), ), ), diff --git a/packages/reown_appkit/lib/modal/pages/public/appkit_modal_qrcode_page.dart b/packages/reown_appkit/lib/modal/pages/public/appkit_modal_qrcode_page.dart index 80a3218e..47452bf1 100644 --- a/packages/reown_appkit/lib/modal/pages/public/appkit_modal_qrcode_page.dart +++ b/packages/reown_appkit/lib/modal/pages/public/appkit_modal_qrcode_page.dart @@ -77,7 +77,7 @@ class _AppKitModalQRCodePageState extends State { direction: isPortrait ? Axis.vertical : Axis.horizontal, children: [ Padding( - padding: EdgeInsets.all(20.0), + padding: const EdgeInsets.all(20.0), child: _qrQodeWidget ?? AspectRatio( diff --git a/packages/reown_appkit/lib/modal/pages/public/dwe/appkit_modal_dwe_page.dart b/packages/reown_appkit/lib/modal/pages/public/dwe/appkit_modal_dwe_page.dart index ccffd3cf..5d3c5870 100644 --- a/packages/reown_appkit/lib/modal/pages/public/dwe/appkit_modal_dwe_page.dart +++ b/packages/reown_appkit/lib/modal/pages/public/dwe/appkit_modal_dwe_page.dart @@ -148,7 +148,7 @@ class _ReownAppKitModalDepositScreenState color: themeColors.foreground300, ), ), - Spacer(), + const Spacer(), AssetsButton( disabled: _dweService.preselectedAsset != null, ), diff --git a/packages/reown_appkit/lib/modal/pages/public/dwe/configured_assets_selector_page.dart b/packages/reown_appkit/lib/modal/pages/public/dwe/configured_assets_selector_page.dart index ae210fac..eb3e8df8 100644 --- a/packages/reown_appkit/lib/modal/pages/public/dwe/configured_assets_selector_page.dart +++ b/packages/reown_appkit/lib/modal/pages/public/dwe/configured_assets_selector_page.dart @@ -53,7 +53,7 @@ class ConfiguredAssetsSelectorPage extends StatelessWidget { child: Container( width: double.infinity, padding: const EdgeInsets.symmetric(vertical: 20.0), - child: Center( + child: const Center( child: Text('No assets supported for this network'), ), ), @@ -75,7 +75,7 @@ class ConfiguredAssetsSelectorPage extends StatelessWidget { builder: (context, snapshot) { return AccountListItem( padding: const EdgeInsets.all(0.0), - backgroundColor: WidgetStatePropertyAll( + backgroundColor: const WidgetStatePropertyAll( Colors.transparent, ), iconWidget: Padding( @@ -96,7 +96,7 @@ class ConfiguredAssetsSelectorPage extends StatelessWidget { child: Container( decoration: BoxDecoration( color: themeColors.background150, - borderRadius: BorderRadius.all( + borderRadius: const BorderRadius.all( Radius.circular(30.0), ), ), diff --git a/packages/reown_appkit/lib/modal/pages/public/dwe/exchange_assets_selector_page.dart b/packages/reown_appkit/lib/modal/pages/public/dwe/exchange_assets_selector_page.dart index e4b65fda..bcdc6d4c 100644 --- a/packages/reown_appkit/lib/modal/pages/public/dwe/exchange_assets_selector_page.dart +++ b/packages/reown_appkit/lib/modal/pages/public/dwe/exchange_assets_selector_page.dart @@ -146,7 +146,7 @@ class _ExchangeAssetsSelectorPageState color: themeColors.foreground200, ), ), - Spacer(), + const Spacer(), _ShimmerWidget( enabled: _loadingQuote, child: Text( @@ -157,7 +157,7 @@ class _ExchangeAssetsSelectorPageState ], ), ), - SizedBox.square(dimension: kPadding12), + const SizedBox.square(dimension: kPadding12), Expanded( child: Container( padding: const EdgeInsets.all(kPadding12), @@ -184,7 +184,7 @@ class _ExchangeAssetsSelectorPageState color: themeColors.foreground200, ), ), - SizedBox.square(dimension: kPadding12), + const SizedBox.square(dimension: kPadding12), Expanded( child: _AssetOptionsList( exchangeAssets: exchangeAssets, @@ -195,14 +195,14 @@ class _ExchangeAssetsSelectorPageState ), ), // - SizedBox.square(dimension: kPadding12), + const SizedBox.square(dimension: kPadding12), _PaymentDetails( quoteResult: _quoteResult, loadingQuote: _loadingQuote, ), - SizedBox.square(dimension: kPadding12), + const SizedBox.square(dimension: kPadding12), Divider(color: themeColors.grayGlass005, height: 0.0), - SizedBox.square(dimension: kPadding12), + const SizedBox.square(dimension: kPadding12), Row( children: [ Expanded( @@ -260,7 +260,7 @@ class _AssetOptionsListState extends State<_AssetOptionsList> { void initState() { super.initState(); _fetchPriceTimer ??= Timer.periodic( - Duration(seconds: 10), + const Duration(seconds: 10), _fetchTokenPrice, ); } @@ -303,7 +303,7 @@ class _AssetOptionsListState extends State<_AssetOptionsList> { child: Container( width: double.infinity, padding: const EdgeInsets.symmetric(vertical: 20.0), - child: Center( + child: const Center( child: Text('No assets supported for this network'), ), ), @@ -324,7 +324,9 @@ class _AssetOptionsListState extends State<_AssetOptionsList> { builder: (context, snapshot) { return AccountListItem( padding: const EdgeInsets.all(0.0), - backgroundColor: WidgetStatePropertyAll(Colors.transparent), + backgroundColor: const WidgetStatePropertyAll( + Colors.transparent, + ), iconWidget: Padding( padding: const EdgeInsets.only(left: kPadding6), child: Stack( @@ -341,7 +343,7 @@ class _AssetOptionsListState extends State<_AssetOptionsList> { child: Container( decoration: BoxDecoration( color: themeColors.background150, - borderRadius: BorderRadius.all( + borderRadius: const BorderRadius.all( Radius.circular(30.0), ), ), @@ -366,8 +368,8 @@ class _AssetOptionsListState extends State<_AssetOptionsList> { visible: widget.selectedExchangeAsset?.address == asset.address, - child: Padding( - padding: const EdgeInsets.only(right: kPadding6), + child: const Padding( + padding: EdgeInsets.only(right: kPadding6), child: Icon(Icons.check, color: Colors.green), ), ), @@ -409,7 +411,7 @@ class _PaymentDetails extends StatelessWidget { color: themeColors.foreground200, ), ), - Spacer(), + const Spacer(), _ShimmerWidget( enabled: loadingQuote, child: Text( @@ -445,7 +447,7 @@ class _PaymentDetails extends StatelessWidget { color: themeColors.foreground200, ), ), - Spacer(), + const Spacer(), _ShimmerWidget( enabled: loadingQuote, child: Text( @@ -544,7 +546,7 @@ class __TitleButtonState extends State<_TitleButton> { void initState() { super.initState(); _fetchPriceTimer ??= Timer.periodic( - Duration(seconds: 10), + const Duration(seconds: 10), _fetchTokenPrice, ); _fetchTokenPrice(_fetchPriceTimer); @@ -572,7 +574,7 @@ class __TitleButtonState extends State<_TitleButton> { final themeColors = ReownAppKitModalTheme.colorsOf(context); final themeData = ReownAppKitModalTheme.getDataOf(context); if (_fungible == null) { - return SizedBox.shrink(); + return const SizedBox.shrink(); } final networkInfo = ReownAppKitModalNetworks.getNetworkInfo( _fungible!.chainId!, diff --git a/packages/reown_appkit/lib/modal/pages/public/dwe/payment_process_page.dart b/packages/reown_appkit/lib/modal/pages/public/dwe/payment_process_page.dart index 6a338f42..7de9c160 100644 --- a/packages/reown_appkit/lib/modal/pages/public/dwe/payment_process_page.dart +++ b/packages/reown_appkit/lib/modal/pages/public/dwe/payment_process_page.dart @@ -175,7 +175,7 @@ class _PaymentProcessPageState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ _CircledSendWidget(), - SizedBox.square(dimension: kPadding12), + const SizedBox.square(dimension: kPadding12), Padding( padding: const EdgeInsets.symmetric(horizontal: kPadding12), child: Column( @@ -188,7 +188,7 @@ class _PaymentProcessPageState extends State { color: themeColors.foreground200, ), ), - Spacer(), + const Spacer(), Text( widget.quoteResult.formattedAmount(), style: themeData.textStyles.paragraph400, @@ -232,14 +232,14 @@ class _PaymentProcessPageState extends State { ], ), ), - SizedBox.square(dimension: kPadding16), + const SizedBox.square(dimension: kPadding16), Divider( color: themeColors.grayGlass010, height: 0.0, indent: kPadding12, endIndent: kPadding12, ), - SizedBox.square(dimension: kPadding16), + const SizedBox.square(dimension: kPadding16), Padding( padding: const EdgeInsets.symmetric(horizontal: kPadding12), child: Row( @@ -250,7 +250,7 @@ class _PaymentProcessPageState extends State { color: themeColors.foreground200, ), ), - Spacer(), + const Spacer(), Text( '${widget.exchange.name} ', style: themeData.textStyles.paragraph400, @@ -263,8 +263,8 @@ class _PaymentProcessPageState extends State { ], ), ), - SizedBox.square(dimension: kPadding16), - SizedBox.square(dimension: kPadding8), + const SizedBox.square(dimension: kPadding16), + const SizedBox.square(dimension: kPadding8), Container( padding: const EdgeInsets.all(kPadding12), decoration: BoxDecoration( @@ -290,7 +290,7 @@ class _PaymentProcessPageState extends State { color: themeColors.foreground200, ), ), - Spacer(), + const Spacer(), WalletItemChip( value: '🕒 Est. ${widget.quoteResult.timeInSeconds} sec', textStyle: themeData.textStyles.tiny400.copyWith( @@ -300,7 +300,7 @@ class _PaymentProcessPageState extends State { ), ], ), - SizedBox.square(dimension: kPadding12), + const SizedBox.square(dimension: kPadding12), _PaymentDetails( quoteResult: widget.quoteResult, depositError: _depositError, @@ -339,7 +339,7 @@ class _PaymentDetails extends StatelessWidget { children: [ AccountListItem( padding: const EdgeInsets.all(0.0), - backgroundColor: WidgetStatePropertyAll(Colors.transparent), + backgroundColor: const WidgetStatePropertyAll(Colors.transparent), iconWidget: Padding( padding: const EdgeInsets.only(left: kPadding6), child: RoundedIcon( @@ -360,7 +360,7 @@ class _PaymentDetails extends StatelessWidget { child: Builder( builder: (_) { if (status == QuoteStatus.waiting) { - return CircularProgressIndicator(strokeWidth: 1.0); + return const CircularProgressIndicator(strokeWidth: 1.0); } if (isError) { return Icon(Icons.close, color: themeColors.error100); @@ -373,7 +373,7 @@ class _PaymentDetails extends StatelessWidget { ), AccountListItem( padding: const EdgeInsets.all(0.0), - backgroundColor: WidgetStatePropertyAll(Colors.transparent), + backgroundColor: const WidgetStatePropertyAll(Colors.transparent), iconWidget: Padding( padding: const EdgeInsets.only(left: kPadding6), child: RoundedIcon( @@ -395,7 +395,7 @@ class _PaymentDetails extends StatelessWidget { builder: (_) { if (status == QuoteStatus.waiting || status == QuoteStatus.pending) { - return CircularProgressIndicator(strokeWidth: 1.0); + return const CircularProgressIndicator(strokeWidth: 1.0); } if (isError) { return Icon(Icons.close, color: themeColors.error100); @@ -408,7 +408,7 @@ class _PaymentDetails extends StatelessWidget { ), AccountListItem( padding: const EdgeInsets.all(0.0), - backgroundColor: WidgetStatePropertyAll(Colors.transparent), + backgroundColor: const WidgetStatePropertyAll(Colors.transparent), iconWidget: Padding( padding: const EdgeInsets.only(left: kPadding6), child: RoundedIcon( @@ -434,7 +434,7 @@ class _PaymentDetails extends StatelessWidget { if (isError) { return Icon(Icons.close, color: themeColors.error100); } - return CircularProgressIndicator(strokeWidth: 1.0); + return const CircularProgressIndicator(strokeWidth: 1.0); }, ), ), @@ -462,7 +462,7 @@ class __CircledSendWidgetState extends State<_CircledSendWidget> { return FutureBuilder( future: _dweService.getFungiblePrice(asset: selectedAsset), builder: (context, snapshot) { - if (snapshot.data == null) return SizedBox.shrink(); + if (snapshot.data == null) return const SizedBox.shrink(); final fungible = snapshot.data!; final networkInfo = ReownAppKitModalNetworks.getNetworkInfo( fungible.chainId!, @@ -482,7 +482,9 @@ class __CircledSendWidgetState extends State<_CircledSendWidget> { width: 170.0, height: 170.0, decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(170.0)), + borderRadius: const BorderRadius.all( + Radius.circular(170.0), + ), border: Border.fromBorderSide( BorderSide( color: themeColors.accenGlass005, @@ -496,7 +498,9 @@ class __CircledSendWidgetState extends State<_CircledSendWidget> { width: 145.0, height: 145.0, decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(145.0)), + borderRadius: const BorderRadius.all( + Radius.circular(145.0), + ), border: Border.fromBorderSide( BorderSide( color: themeColors.accenGlass020, @@ -510,7 +514,9 @@ class __CircledSendWidgetState extends State<_CircledSendWidget> { width: 105.0, height: 105.0, decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(105.0)), + borderRadius: const BorderRadius.all( + Radius.circular(105.0), + ), border: Border.fromBorderSide( BorderSide( color: themeColors.accenGlass020, diff --git a/packages/reown_appkit/lib/modal/pages/public/dwe/widgets/amount_selector.dart b/packages/reown_appkit/lib/modal/pages/public/dwe/widgets/amount_selector.dart index 0d231266..2951fb9f 100644 --- a/packages/reown_appkit/lib/modal/pages/public/dwe/widgets/amount_selector.dart +++ b/packages/reown_appkit/lib/modal/pages/public/dwe/widgets/amount_selector.dart @@ -224,7 +224,7 @@ class _AmountButton extends StatelessWidget { return RoundedRectangleBorder( side: BorderSide(color: themeColors.grayGlass002, width: 1.0), borderRadius: radiuses.isSquare() - ? BorderRadius.all(Radius.zero) + ? const BorderRadius.all(Radius.zero) : BorderRadius.circular(16.0), ); }), diff --git a/packages/reown_appkit/lib/modal/pages/public/dwe/widgets/asset_button.dart b/packages/reown_appkit/lib/modal/pages/public/dwe/widgets/asset_button.dart index 787de0c0..f83eced2 100644 --- a/packages/reown_appkit/lib/modal/pages/public/dwe/widgets/asset_button.dart +++ b/packages/reown_appkit/lib/modal/pages/public/dwe/widgets/asset_button.dart @@ -34,7 +34,7 @@ class _AssetsButtonState extends State { Widget build(BuildContext context) { final selectedAsset = _dweService.depositAsset.value; if (selectedAsset == null) { - return SizedBox.shrink(); + return const SizedBox.shrink(); } final chainInfo = ReownAppKitModalNetworks.getNetworkInfo( selectedAsset.network, @@ -76,7 +76,9 @@ class _AssetsButtonState extends State { semanticsLabel: 'AppKitModalAssetButton', size: widget.size, onTap: () { - _widgetStack.push(ConfiguredAssetsSelectorPage()); + _widgetStack.push( + const ConfiguredAssetsSelectorPage(), + ); }, buttonStyle: _buttonStyle, child: Row( @@ -155,7 +157,9 @@ class _AssetsButtonState extends State { child: Container( decoration: BoxDecoration( color: themeColors.background150, - borderRadius: BorderRadius.all(Radius.circular(30.0)), + borderRadius: const BorderRadius.all( + Radius.circular(30.0), + ), ), padding: const EdgeInsets.all(1.0), clipBehavior: Clip.antiAlias, diff --git a/packages/reown_appkit/lib/modal/pages/public/dwe/widgets/exchanges_list.dart b/packages/reown_appkit/lib/modal/pages/public/dwe/widgets/exchanges_list.dart index f6b6fdc4..8f8b1314 100644 --- a/packages/reown_appkit/lib/modal/pages/public/dwe/widgets/exchanges_list.dart +++ b/packages/reown_appkit/lib/modal/pages/public/dwe/widgets/exchanges_list.dart @@ -26,7 +26,7 @@ class _ExchangesListWidgetState extends State { Widget build(BuildContext context) { final chainInfo = ModalProvider.of(context).instance.selectedChain; if (chainInfo == null) { - return SizedBox.shrink(); + return const SizedBox.shrink(); } return ValueListenableBuilder( @@ -42,10 +42,12 @@ class _ExchangesListWidgetState extends State { } return FutureBuilder( - future: _dweService.getExchanges(params: GetExchangesParams(page: 1)), + future: _dweService.getExchanges( + params: const GetExchangesParams(page: 1), + ), builder: (context, snapshot) { if (!snapshot.hasData && !snapshot.hasError) { - return CircularLoader(); + return const CircularLoader(); } if (snapshot.hasError) { GetIt.I().show( diff --git a/packages/reown_appkit/lib/modal/pages/receive_compatible_networks.dart b/packages/reown_appkit/lib/modal/pages/receive_compatible_networks.dart index 9ebf3616..6d8b0937 100644 --- a/packages/reown_appkit/lib/modal/pages/receive_compatible_networks.dart +++ b/packages/reown_appkit/lib/modal/pages/receive_compatible_networks.dart @@ -57,7 +57,7 @@ class ReceiveCompatibleNetworks extends StatelessWidget { return networks[index - 1]; }, separatorBuilder: (BuildContext context, int index) { - return SizedBox.square(dimension: kPadding6); + return const SizedBox.square(dimension: kPadding6); }, itemCount: networks.length + 1, ), diff --git a/packages/reown_appkit/lib/modal/pages/receive_page.dart b/packages/reown_appkit/lib/modal/pages/receive_page.dart index 12965450..0339a5d3 100644 --- a/packages/reown_appkit/lib/modal/pages/receive_page.dart +++ b/packages/reown_appkit/lib/modal/pages/receive_page.dart @@ -158,7 +158,7 @@ class ReceivePage extends StatelessWidget { color: themeColors.foreground200, ), onTap: () { - _widgetStack.push(ReceiveCompatibleNetworks()); + _widgetStack.push(const ReceiveCompatibleNetworks()); }, ), ), diff --git a/packages/reown_appkit/lib/modal/pages/select_token_page.dart b/packages/reown_appkit/lib/modal/pages/select_token_page.dart index d44bf03d..027b119b 100644 --- a/packages/reown_appkit/lib/modal/pages/select_token_page.dart +++ b/packages/reown_appkit/lib/modal/pages/select_token_page.dart @@ -95,7 +95,9 @@ class _SelectTokenPageState extends State { ..._tokens.mapIndexed((index, token) { return AccountListItem( padding: const EdgeInsets.all(0.0), - backgroundColor: WidgetStatePropertyAll(Colors.transparent), + backgroundColor: const WidgetStatePropertyAll( + Colors.transparent, + ), iconWidget: Padding( padding: const EdgeInsets.only(left: kPadding6), child: Stack( @@ -132,7 +134,7 @@ class _SelectTokenPageState extends State { child: Container( decoration: BoxDecoration( color: themeColors.background150, - borderRadius: BorderRadius.all( + borderRadius: const BorderRadius.all( Radius.circular(30.0), ), ), @@ -167,7 +169,7 @@ class _SelectTokenPageState extends State { color: themeColors.foreground100, ), ), - SizedBox.square(dimension: kPadding6), + const SizedBox.square(dimension: kPadding6), ], ), onTap: () { diff --git a/packages/reown_appkit/lib/modal/pages/send_page.dart b/packages/reown_appkit/lib/modal/pages/send_page.dart index 5b8ba72c..6a0dcd28 100644 --- a/packages/reown_appkit/lib/modal/pages/send_page.dart +++ b/packages/reown_appkit/lib/modal/pages/send_page.dart @@ -186,7 +186,7 @@ class _SendPageState extends State with WidgetsBindingObserver { color: themeColors.background200, width: 1.0, ), - borderRadius: BorderRadius.all(Radius.circular(16.0)), + borderRadius: const BorderRadius.all(Radius.circular(16.0)), ), padding: const EdgeInsets.all(6.0), child: RoundedIcon( @@ -214,7 +214,7 @@ class _SendPageState extends State with WidgetsBindingObserver { title: ' ${_selectedToken.symbol}', iconUrl: _selectedToken.iconUrl, onTap: () { - _widgetStack.push(SelectTokenPage()); + _widgetStack.push(const SelectTokenPage()); }, ), Positioned( @@ -223,7 +223,7 @@ class _SendPageState extends State with WidgetsBindingObserver { child: Container( decoration: BoxDecoration( color: themeColors.background150, - borderRadius: BorderRadius.all( + borderRadius: const BorderRadius.all( Radius.circular(30.0), ), ), @@ -300,13 +300,13 @@ class _SendPageState extends State with WidgetsBindingObserver { margin: const EdgeInsets.only(left: 60.0), color: themeColors.background125, height: kPadding8, - child: SizedBox.square(dimension: 10.0), + child: const SizedBox.square(dimension: 10.0), ), Container( margin: const EdgeInsets.only(right: 60.0), color: themeColors.background125, height: kPadding8, - child: SizedBox.square(dimension: 10.0), + child: const SizedBox.square(dimension: 10.0), ), ], ), diff --git a/packages/reown_appkit/lib/modal/pages/social_login_page.dart b/packages/reown_appkit/lib/modal/pages/social_login_page.dart index d355d547..c443556a 100644 --- a/packages/reown_appkit/lib/modal/pages/social_login_page.dart +++ b/packages/reown_appkit/lib/modal/pages/social_login_page.dart @@ -118,7 +118,7 @@ class _SocialLoginPageState extends State { @override Widget build(BuildContext context) { if (_service == null) { - return ContentLoading(); + return const ContentLoading(); } final themeData = ReownAppKitModalTheme.getDataOf(context); final themeColors = ReownAppKitModalTheme.colorsOf(context); @@ -263,7 +263,7 @@ class __LoadingIconState extends State<_LoadingIcon> { child: Container( decoration: BoxDecoration( color: themeColors.background125, - borderRadius: BorderRadius.all(Radius.circular(30.0)), + borderRadius: const BorderRadius.all(Radius.circular(30.0)), ), padding: const EdgeInsets.all(1.0), clipBehavior: Clip.antiAlias, diff --git a/packages/reown_appkit/lib/modal/pages/wallet_features_page.dart b/packages/reown_appkit/lib/modal/pages/wallet_features_page.dart index b3d87ae1..4b35c577 100644 --- a/packages/reown_appkit/lib/modal/pages/wallet_features_page.dart +++ b/packages/reown_appkit/lib/modal/pages/wallet_features_page.dart @@ -71,7 +71,7 @@ class _WalletFeaturesPageState extends State @override Widget build(BuildContext context) { if (_appKitModal == null) { - return ContentLoading(viewHeight: 400.0); + return const ContentLoading(viewHeight: 400.0); } final themeColors = ReownAppKitModalTheme.colorsOf(context); @@ -85,7 +85,7 @@ class _WalletFeaturesPageState extends State width: kNavbarHeight * 1.3, child: GestureDetector( onTap: () => _widgetStack.push( - ReownAppKitModalSelectNetworkPage(), + const ReownAppKitModalSelectNetworkPage(), event: ClickNetworksEvent(), ), child: Row( @@ -198,7 +198,7 @@ class _SmartAccountViewState extends State<_SmartAccountView> { AddressButton( service: widget.appKitModal, onTap: () { - _widgetStack.push(AccountPage()); + _widgetStack.push(const AccountPage()); }, ), const SizedBox.square(dimension: kPadding8), @@ -235,7 +235,7 @@ class _SmartAccountViewState extends State<_SmartAccountView> { size: BaseButtonSize.big, iconSize: 20.0, fontSize: 1.0, - onTap: () => _widgetStack.push(ReceivePage()), + onTap: () => _widgetStack.push(const ReceivePage()), ), ), const SizedBox.square(dimension: kPadding8), @@ -251,7 +251,7 @@ class _SmartAccountViewState extends State<_SmartAccountView> { fontSize: 1.0, onTap: _tokens.isEmpty ? null - : () => _widgetStack.push(SendPage()), + : () => _widgetStack.push(const SendPage()), ), ), ], @@ -280,7 +280,7 @@ class _SmartAccountViewState extends State<_SmartAccountView> { ..._tokens.mapIndexed((index, token) { return AccountListItem( padding: const EdgeInsets.all(0.0), - backgroundColor: WidgetStatePropertyAll( + backgroundColor: const WidgetStatePropertyAll( Colors.transparent, ), iconWidget: Padding( @@ -315,7 +315,7 @@ class _SmartAccountViewState extends State<_SmartAccountView> { child: Container( decoration: BoxDecoration( color: themeColors.background150, - borderRadius: BorderRadius.all( + borderRadius: const BorderRadius.all( Radius.circular(30.0), ), ), @@ -345,7 +345,7 @@ class _SmartAccountViewState extends State<_SmartAccountView> { style: themeData.textStyles.paragraph500 .copyWith(color: themeColors.foreground100), ), - SizedBox.square(dimension: kPadding6), + const SizedBox.square(dimension: kPadding6), ], ), ); @@ -405,7 +405,7 @@ class _ReceiveFundsEmptyStateButton extends StatelessWidget { subtitleStyle: themeData.textStyles.tiny400.copyWith( color: themeColors.foreground150, ), - onTap: () => _widgetStack.push(ReceivePage()), + onTap: () => _widgetStack.push(const ReceivePage()), ), SizedBox.square( dimension: MediaQuery.of(context).padding.bottom + kPadding6, diff --git a/packages/reown_appkit/lib/modal/services/analytics_service/models/analytics_event.dart b/packages/reown_appkit/lib/modal/services/analytics_service/models/analytics_event.dart index 6cde52f2..4bfec6e2 100644 --- a/packages/reown_appkit/lib/modal/services/analytics_service/models/analytics_event.dart +++ b/packages/reown_appkit/lib/modal/services/analytics_service/models/analytics_event.dart @@ -244,7 +244,7 @@ class UserRejectedEvent extends _AnalyticsEvent { @override CoreEventProperties? get properties => - CoreEventProperties(message: 'User declined connection'); + const CoreEventProperties(message: 'User declined connection'); } class DisconnectSuccessEvent extends _AnalyticsEvent { diff --git a/packages/reown_appkit/lib/modal/services/blockchain_service/blockchain_service.dart b/packages/reown_appkit/lib/modal/services/blockchain_service/blockchain_service.dart index 79a51089..e3fb8f26 100644 --- a/packages/reown_appkit/lib/modal/services/blockchain_service/blockchain_service.dart +++ b/packages/reown_appkit/lib/modal/services/blockchain_service/blockchain_service.dart @@ -336,7 +336,7 @@ class BlockChainService implements IBlockChainService { return jsonResponse.result as T; } throw jsonResponse.error ?? - ReownSignError(code: 0, message: 'Error parsing result'); + const ReownSignError(code: 0, message: 'Error parsing result'); } BigInt _parseEstimateGasResult(String gasResult) { diff --git a/packages/reown_appkit/lib/modal/services/coinbase_service/coinbase_service.dart b/packages/reown_appkit/lib/modal/services/coinbase_service/coinbase_service.dart index 730cb275..b4ea1861 100644 --- a/packages/reown_appkit/lib/modal/services/coinbase_service/coinbase_service.dart +++ b/packages/reown_appkit/lib/modal/services/coinbase_service/coinbase_service.dart @@ -296,7 +296,7 @@ extension on SessionRequestParams { final jsonData = _getDataFromParamsList(method, params); return SignTypedDataV4(address: address, typedDataJson: jsonData); case 'eth_requestAccounts': - return RequestAccounts(); + return const RequestAccounts(); case 'eth_signTransaction': case MethodsConstants.ethSendTransaction: BigInt? weiValue; diff --git a/packages/reown_appkit/lib/modal/services/dwe_service/dwe_service.dart b/packages/reown_appkit/lib/modal/services/dwe_service/dwe_service.dart index 99310a41..58dd1253 100644 --- a/packages/reown_appkit/lib/modal/services/dwe_service/dwe_service.dart +++ b/packages/reown_appkit/lib/modal/services/dwe_service/dwe_service.dart @@ -187,7 +187,7 @@ class DWEService implements IDWEService { if (currentAttempt < maxAttempts && !_shouldStopLooping) { // Keep trying completer.call((quoteStatus, null)); - await Future.delayed(Duration(seconds: 3)); + await Future.delayed(const Duration(seconds: 3)); } else { // Max attempts reached or stopped by user, complete with appropriate status stopCheckingStatus(); @@ -298,7 +298,7 @@ class DWEService implements IDWEService { if (currentAttempt < maxAttempts && !_shouldStopLooping) { // Keep trying completer.call((quoteStatus, null)); - await Future.delayed(Duration(seconds: 3)); + await Future.delayed(const Duration(seconds: 3)); } else { // Max attempts reached or stopped by user, complete with appropriate status stopCheckingStatus(); @@ -346,7 +346,7 @@ class DWEService implements IDWEService { if (currentAttempt < maxAttempts && !_shouldStopLooping) { // Keep trying completer.call((quoteStatus, null)); - await Future.delayed(Duration(seconds: 3)); + await Future.delayed(const Duration(seconds: 3)); } else { // Max attempts reached or stopped by user, complete with appropriate status stopCheckingStatus(); @@ -394,7 +394,7 @@ class DWEService implements IDWEService { if (currentAttempt < maxAttempts && !_shouldStopLooping) { // Keep trying completer.call((quoteStatus, null)); - await Future.delayed(Duration(seconds: 3)); + await Future.delayed(const Duration(seconds: 3)); } else { // Max attempts reached or stopped by user, complete with appropriate status stopCheckingStatus(); @@ -488,7 +488,7 @@ class DWEService implements IDWEService { final response = await http .get(url, headers: _requiredHeaders) - .timeout(Duration(seconds: 30)); + .timeout(const Duration(seconds: 30)); if (response.statusCode == 200 && response.body.isNotEmpty) { final jsonResponse = jsonDecode(response.body) as Map; @@ -536,7 +536,7 @@ class DWEService implements IDWEService { }); final response = await http .post(url, headers: _requiredHeaders, body: body) - .timeout(Duration(seconds: 30)); + .timeout(const Duration(seconds: 30)); if (response.statusCode == 200 && response.body.isNotEmpty) { final jsonResponse = jsonDecode(response.body); diff --git a/packages/reown_appkit/lib/modal/services/magic_service/magic_service.dart b/packages/reown_appkit/lib/modal/services/magic_service/magic_service.dart index c5882bf2..76e76af8 100644 --- a/packages/reown_appkit/lib/modal/services/magic_service/magic_service.dart +++ b/packages/reown_appkit/lib/modal/services/magic_service/magic_service.dart @@ -26,7 +26,7 @@ class MagicService implements IMagicService { ConnectionMetadata get _selfMetadata => ConnectionMetadata(metadata: _metadata, publicKey: ''); - ConnectionMetadata get _peerMetadata => ConnectionMetadata( + ConnectionMetadata get _peerMetadata => const ConnectionMetadata( metadata: PairingMetadata( name: 'Social Wallet', description: '', @@ -190,7 +190,7 @@ class MagicService implements IMagicService { if (_onLoadCount < 2 && Platform.isAndroid) return; await _runJavascript(); await _fitToScreen(); - Future.delayed(Duration(milliseconds: 600)).then((value) { + Future.delayed(const Duration(milliseconds: 600)).then((value) { if (_initializedCompleter.isCompleted) return; _initializedCompleter.complete(true); }); @@ -412,7 +412,7 @@ class MagicService implements IMagicService { final requestUri = uri.replace(queryParameters: queryParams); await _webViewController.loadRequest(requestUri, headers: headers); // in case connection message or even the request itself hangs there's no other way to continue the flow than timing it out. - _timeOutTimer ??= Timer.periodic(Duration(seconds: 1), _timeOut); + _timeOutTimer ??= Timer.periodic(const Duration(seconds: 1), _timeOut); } catch (e) { _initializedCompleter.complete(false); } diff --git a/packages/reown_appkit/lib/modal/services/magic_service/models/frame_message.dart b/packages/reown_appkit/lib/modal/services/magic_service/models/frame_message.dart index 1f00e2de..16488eb2 100644 --- a/packages/reown_appkit/lib/modal/services/magic_service/models/frame_message.dart +++ b/packages/reown_appkit/lib/modal/services/magic_service/models/frame_message.dart @@ -299,7 +299,7 @@ class SyncTheme extends MessageData { @override String toString() { final mode = theme?.isDarkMode == true ? 'dark' : 'light'; - final themeData = theme?.themeData ?? ReownAppKitModalThemeData(); + final themeData = theme?.themeData ?? const ReownAppKitModalThemeData(); late ReownAppKitModalColors colors; if (mode == 'dark') { colors = themeData.darkColors; diff --git a/packages/reown_appkit/lib/modal/services/phantom_service/phantom_helper.dart b/packages/reown_appkit/lib/modal/services/phantom_service/phantom_helper.dart index d7cc0a62..91da1714 100644 --- a/packages/reown_appkit/lib/modal/services/phantom_service/phantom_helper.dart +++ b/packages/reown_appkit/lib/modal/services/phantom_service/phantom_helper.dart @@ -297,7 +297,7 @@ class PhantomHelper { ); final payload = { - ...JsonDecoder().convert(String.fromCharCodes(decryptedData!)), + ...const JsonDecoder().convert(String.fromCharCodes(decryptedData!)), if (phantomKey.isNotEmpty) 'phantom_encryption_public_key': phantomKey, if (phantomRequest.isNotEmpty) 'phantomRequest': phantomRequest, }; diff --git a/packages/reown_appkit/lib/modal/services/siwe_service/siwe_service.dart b/packages/reown_appkit/lib/modal/services/siwe_service/siwe_service.dart index 1dc9b46a..e2054c8b 100644 --- a/packages/reown_appkit/lib/modal/services/siwe_service/siwe_service.dart +++ b/packages/reown_appkit/lib/modal/services/siwe_service/siwe_service.dart @@ -72,7 +72,7 @@ class SiweService implements ISiweService { address: '$chainId:$address', chainId: chainId, nonce: nonce, - type: messageParams.type ?? CacaoHeader(t: 'eip4361'), + type: messageParams.type ?? const CacaoHeader(t: 'eip4361'), ); _appKit.core.logger.d('[$runtimeType] createMessage() called'); diff --git a/packages/reown_appkit/lib/modal/services/solflare_service/solflare_helper.dart b/packages/reown_appkit/lib/modal/services/solflare_service/solflare_helper.dart index 6b8d3c6e..db296880 100644 --- a/packages/reown_appkit/lib/modal/services/solflare_service/solflare_helper.dart +++ b/packages/reown_appkit/lib/modal/services/solflare_service/solflare_helper.dart @@ -300,7 +300,7 @@ class SolflareHelper { ); final payload = { - ...JsonDecoder().convert(String.fromCharCodes(decryptedData!)), + ...const JsonDecoder().convert(String.fromCharCodes(decryptedData!)), if (solflareKey.isNotEmpty) 'solflare_encryption_public_key': solflareKey, if (solflareRequest.isNotEmpty) 'solflareRequest': solflareRequest, diff --git a/packages/reown_appkit/lib/modal/services/transfers/transfers_service.dart b/packages/reown_appkit/lib/modal/services/transfers/transfers_service.dart index 56dd5e1c..16b35440 100644 --- a/packages/reown_appkit/lib/modal/services/transfers/transfers_service.dart +++ b/packages/reown_appkit/lib/modal/services/transfers/transfers_service.dart @@ -162,7 +162,7 @@ class TransfersService implements ITransfersService { headers: _requiredHeaders, body: body, ) - .timeout(Duration(seconds: 30)); + .timeout(const Duration(seconds: 30)); final responseBody = response.body; core.logger.d('[$runtimeType] -- quote response: $responseBody'); diff --git a/packages/reown_appkit/lib/modal/utils/public/appkit_modal_default_networks.dart b/packages/reown_appkit/lib/modal/utils/public/appkit_modal_default_networks.dart index f5258954..80a5dfc3 100644 --- a/packages/reown_appkit/lib/modal/utils/public/appkit_modal_default_networks.dart +++ b/packages/reown_appkit/lib/modal/utils/public/appkit_modal_default_networks.dart @@ -225,7 +225,7 @@ class ReownAppKitModalNetworks { static final Map> _testnets = { NetworkUtils.eip155: [ - ReownAppKitModalNetworkInfo( + const ReownAppKitModalNetworkInfo( name: 'Eth sepolia', chainId: '11155111', currency: 'SEP', @@ -234,7 +234,7 @@ class ReownAppKitModalNetworks { explorerUrl: 'https://sepolia.etherscan.io/', isTestNetwork: true, ), - ReownAppKitModalNetworkInfo( + const ReownAppKitModalNetworkInfo( name: 'Eth holesky', chainId: '17000', currency: 'ETH', @@ -243,7 +243,7 @@ class ReownAppKitModalNetworks { explorerUrl: 'https://explorer.holesky.test', isTestNetwork: true, ), - ReownAppKitModalNetworkInfo( + const ReownAppKitModalNetworkInfo( name: 'Pol amoy', chainId: '80002', currency: 'POL', @@ -252,7 +252,7 @@ class ReownAppKitModalNetworks { explorerUrl: 'https://amoy.polygonscan.com', isTestNetwork: true, ), - ReownAppKitModalNetworkInfo( + const ReownAppKitModalNetworkInfo( name: 'BSC testnet', chainId: '97', currency: 'tBNB', @@ -261,7 +261,7 @@ class ReownAppKitModalNetworks { explorerUrl: 'https://testnet.bscscan.com', isTestNetwork: true, ), - ReownAppKitModalNetworkInfo( + const ReownAppKitModalNetworkInfo( name: 'Base sepolia', chainId: '84532', currency: 'SEP', @@ -270,7 +270,7 @@ class ReownAppKitModalNetworks { explorerUrl: 'https://sepolia.basescan.org/', isTestNetwork: true, ), - ReownAppKitModalNetworkInfo( + const ReownAppKitModalNetworkInfo( name: 'Sonic testnet', chainId: '57054', currency: 'wS', @@ -281,7 +281,7 @@ class ReownAppKitModalNetworks { ), ], NetworkUtils.solana: [ - ReownAppKitModalNetworkInfo( + const ReownAppKitModalNetworkInfo( name: 'Sol testnet', chainId: '4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z', currency: 'SOL', @@ -290,7 +290,7 @@ class ReownAppKitModalNetworks { explorerUrl: 'https://explorer.solana.com/?cluster=testnet', isTestNetwork: true, ), - ReownAppKitModalNetworkInfo( + const ReownAppKitModalNetworkInfo( name: 'Sol devnet', chainId: 'EtWTRABZaYq6iMfeYKouRu166VU2xqa1', currency: 'SOL', @@ -301,7 +301,7 @@ class ReownAppKitModalNetworks { ), ], 'bip122': [ - ReownAppKitModalNetworkInfo( + const ReownAppKitModalNetworkInfo( name: 'Btc testnet', chainId: '000000000933ea01ad0ee984209779ba', currency: 'BTC', @@ -311,7 +311,7 @@ class ReownAppKitModalNetworks { ), ], 'sui': [ - ReownAppKitModalNetworkInfo( + const ReownAppKitModalNetworkInfo( name: 'Sui testnet', chainId: 'testnet', currency: 'SUI', @@ -319,7 +319,7 @@ class ReownAppKitModalNetworks { explorerUrl: 'https://suiscan.xyz/testnet/home', isTestNetwork: true, ), - ReownAppKitModalNetworkInfo( + const ReownAppKitModalNetworkInfo( name: 'Sui devnet', chainId: 'devnet', currency: 'SUI', @@ -329,7 +329,7 @@ class ReownAppKitModalNetworks { ), ], 'tron': [ - ReownAppKitModalNetworkInfo( + const ReownAppKitModalNetworkInfo( name: 'Tron nile', chainId: '0xcd8690dc', currency: 'TRX', @@ -339,7 +339,7 @@ class ReownAppKitModalNetworks { ), ], 'ton': [ - ReownAppKitModalNetworkInfo( + const ReownAppKitModalNetworkInfo( name: 'Ton testnet', chainId: '-3', currency: 'TON', @@ -349,7 +349,7 @@ class ReownAppKitModalNetworks { ), ], 'stacks': [ - ReownAppKitModalNetworkInfo( + const ReownAppKitModalNetworkInfo( name: 'Stacks testnet', chainId: '2147483648', currency: 'STX', diff --git a/packages/reown_appkit/lib/modal/utils/render_utils.dart b/packages/reown_appkit/lib/modal/utils/render_utils.dart index 5268c939..065a0122 100644 --- a/packages/reown_appkit/lib/modal/utils/render_utils.dart +++ b/packages/reown_appkit/lib/modal/utils/render_utils.dart @@ -14,11 +14,11 @@ class RenderUtils { } static List get defaultAvatarColors => [ - Color(0xFFf5ccfc), - Color(0xFFdba4f5), - Color(0xFF9a8ee8), - Color(0xFF6493da), - Color(0xFF6ebdea), + const Color(0xFFf5ccfc), + const Color(0xFFdba4f5), + const Color(0xFF9a8ee8), + const Color(0xFF6493da), + const Color(0xFF6ebdea), ]; static List generateAvatarColors(String? address) { diff --git a/packages/reown_appkit/lib/modal/widgets/buttons/simple_icon_button.dart b/packages/reown_appkit/lib/modal/widgets/buttons/simple_icon_button.dart index 84b80bd0..20cb8f83 100644 --- a/packages/reown_appkit/lib/modal/widgets/buttons/simple_icon_button.dart +++ b/packages/reown_appkit/lib/modal/widgets/buttons/simple_icon_button.dart @@ -75,7 +75,7 @@ class SimpleIconButton extends StatelessWidget { }) : null, padding: WidgetStateProperty.all( - EdgeInsets.all(0.0), + const EdgeInsets.all(0.0), ), ), child: Row( diff --git a/packages/reown_appkit/lib/modal/widgets/buttons/social_login_buttons_view.dart b/packages/reown_appkit/lib/modal/widgets/buttons/social_login_buttons_view.dart index bb10de62..77c357f2 100644 --- a/packages/reown_appkit/lib/modal/widgets/buttons/social_login_buttons_view.dart +++ b/packages/reown_appkit/lib/modal/widgets/buttons/social_login_buttons_view.dart @@ -148,7 +148,7 @@ class _SocialLoginButtonsViewState extends State { Builder( builder: (_) { if (firstItem == null) { - return SizedBox.shrink(); + return const SizedBox.shrink(); } return Column( children: [ diff --git a/packages/reown_appkit/lib/modal/widgets/lists/activity_item.dart b/packages/reown_appkit/lib/modal/widgets/lists/activity_item.dart index 3241c434..cc575957 100644 --- a/packages/reown_appkit/lib/modal/widgets/lists/activity_item.dart +++ b/packages/reown_appkit/lib/modal/widgets/lists/activity_item.dart @@ -109,7 +109,7 @@ class ActivityListItem extends StatelessWidget { child: Container( decoration: BoxDecoration( color: themeColors.background150, - borderRadius: BorderRadius.all(Radius.circular(30.0)), + borderRadius: const BorderRadius.all(Radius.circular(30.0)), ), padding: const EdgeInsets.all(1.0), clipBehavior: Clip.antiAlias, @@ -296,11 +296,11 @@ class ActivityListItemLoader extends StatelessWidget { margin: const EdgeInsets.only(left: 4.0), decoration: BoxDecoration( color: themeColors.grayGlass010, - borderRadius: BorderRadius.all( + borderRadius: const BorderRadius.all( Radius.circular(30.0), ), ), - child: SizedBox(), + child: const SizedBox(), ), ), ], @@ -311,9 +311,11 @@ class ActivityListItemLoader extends StatelessWidget { margin: const EdgeInsets.only(top: 4.0), decoration: BoxDecoration( color: themeColors.grayGlass010, - borderRadius: BorderRadius.all(Radius.circular(30.0)), + borderRadius: const BorderRadius.all( + Radius.circular(30.0), + ), ), - child: SizedBox(), + child: const SizedBox(), ), ], ), @@ -325,9 +327,9 @@ class ActivityListItemLoader extends StatelessWidget { margin: const EdgeInsets.only(left: 4.0), decoration: BoxDecoration( color: themeColors.grayGlass010, - borderRadius: BorderRadius.all(Radius.circular(30.0)), + borderRadius: const BorderRadius.all(Radius.circular(30.0)), ), - child: SizedBox(), + child: const SizedBox(), ), const SizedBox.square(dimension: 8.0), ], @@ -365,16 +367,24 @@ class _HalfIconImage extends StatelessWidget { child: ClipRRect( borderRadius: BorderRadius.only( topLeft: isLeft - ? (isNFT ? Radius.circular(8.0) : Radius.circular(100.0)) + ? (isNFT + ? const Radius.circular(8.0) + : const Radius.circular(100.0)) : Radius.zero, bottomLeft: isLeft - ? (isNFT ? Radius.circular(8.0) : Radius.circular(100.0)) + ? (isNFT + ? const Radius.circular(8.0) + : const Radius.circular(100.0)) : Radius.zero, topRight: !isLeft - ? (isNFT ? Radius.circular(8.0) : Radius.circular(100.0)) + ? (isNFT + ? const Radius.circular(8.0) + : const Radius.circular(100.0)) : Radius.zero, bottomRight: !isLeft - ? (isNFT ? Radius.circular(8.0) : Radius.circular(100.0)) + ? (isNFT + ? const Radius.circular(8.0) + : const Radius.circular(100.0)) : Radius.zero, ), child: CachedNetworkImage( diff --git a/packages/reown_appkit/lib/modal/widgets/lists/grid_items/wallet_grid_item.dart b/packages/reown_appkit/lib/modal/widgets/lists/grid_items/wallet_grid_item.dart index f9455d5c..9eeaafb8 100644 --- a/packages/reown_appkit/lib/modal/widgets/lists/grid_items/wallet_grid_item.dart +++ b/packages/reown_appkit/lib/modal/widgets/lists/grid_items/wallet_grid_item.dart @@ -57,7 +57,9 @@ class WalletGridItem extends StatelessWidget { child: Container( decoration: BoxDecoration( color: themeColors.background150, - borderRadius: BorderRadius.all(Radius.circular(30.0)), + borderRadius: const BorderRadius.all( + Radius.circular(30.0), + ), ), padding: const EdgeInsets.all(1.0), clipBehavior: Clip.antiAlias, @@ -82,7 +84,9 @@ class WalletGridItem extends StatelessWidget { child: Container( decoration: BoxDecoration( color: themeColors.background150, - borderRadius: BorderRadius.all(Radius.circular(30.0)), + borderRadius: const BorderRadius.all( + Radius.circular(30.0), + ), ), clipBehavior: Clip.antiAlias, child: SvgPicture.asset( diff --git a/packages/reown_appkit/lib/modal/widgets/lists/list_items/all_wallets_item.dart b/packages/reown_appkit/lib/modal/widgets/lists/list_items/all_wallets_item.dart index d6a2e5db..7e373d4b 100644 --- a/packages/reown_appkit/lib/modal/widgets/lists/list_items/all_wallets_item.dart +++ b/packages/reown_appkit/lib/modal/widgets/lists/list_items/all_wallets_item.dart @@ -36,7 +36,9 @@ class AllWalletsItem extends StatelessWidget { dimension: constraints.maxHeight, child: leading ?? - ThemedIcon(iconPath: 'lib/modal/assets/icons/dots.svg'), + const ThemedIcon( + iconPath: 'lib/modal/assets/icons/dots.svg', + ), ), Expanded( child: Padding( diff --git a/packages/reown_appkit/lib/modal/widgets/lists/list_items/base_list_item.dart b/packages/reown_appkit/lib/modal/widgets/lists/list_items/base_list_item.dart index 5f2fda94..b677485f 100644 --- a/packages/reown_appkit/lib/modal/widgets/lists/list_items/base_list_item.dart +++ b/packages/reown_appkit/lib/modal/widgets/lists/list_items/base_list_item.dart @@ -73,7 +73,7 @@ class BaseListItem extends StatelessWidget { child: Row( children: [ Expanded(child: child), - trailing ?? SizedBox.shrink(), + trailing ?? const SizedBox.shrink(), ], ), ), diff --git a/packages/reown_appkit/lib/modal/widgets/lists/list_items/download_wallet_item.dart b/packages/reown_appkit/lib/modal/widgets/lists/list_items/download_wallet_item.dart index e641a651..5ae4f057 100644 --- a/packages/reown_appkit/lib/modal/widgets/lists/list_items/download_wallet_item.dart +++ b/packages/reown_appkit/lib/modal/widgets/lists/list_items/download_wallet_item.dart @@ -34,7 +34,7 @@ class DownloadWalletItem extends StatelessWidget { Widget build(BuildContext context) { final themeColors = ReownAppKitModalTheme.colorsOf(context); if (_storeUrl.isEmpty) { - return SizedBox.shrink(); + return const SizedBox.shrink(); } return WalletListItem( hideAvatar: true, diff --git a/packages/reown_appkit/lib/modal/widgets/lists/list_items/wallet_list_item.dart b/packages/reown_appkit/lib/modal/widgets/lists/list_items/wallet_list_item.dart index eaf83e68..8fe20813 100644 --- a/packages/reown_appkit/lib/modal/widgets/lists/list_items/wallet_list_item.dart +++ b/packages/reown_appkit/lib/modal/widgets/lists/list_items/wallet_list_item.dart @@ -61,7 +61,9 @@ class WalletListItem extends StatelessWidget { child: Container( decoration: BoxDecoration( color: themeColors.background150, - borderRadius: BorderRadius.all(Radius.circular(30.0)), + borderRadius: const BorderRadius.all( + Radius.circular(30.0), + ), ), padding: const EdgeInsets.all(1.0), clipBehavior: Clip.antiAlias, diff --git a/packages/reown_appkit/lib/modal/widgets/lists/wallets_list.dart b/packages/reown_appkit/lib/modal/widgets/lists/wallets_list.dart index fa2d05d0..75c25944 100644 --- a/packages/reown_appkit/lib/modal/widgets/lists/wallets_list.dart +++ b/packages/reown_appkit/lib/modal/widgets/lists/wallets_list.dart @@ -101,7 +101,7 @@ class WalletsList extends StatelessWidget { return SizedBox(width: 1000.0, child: items[index]); }, separatorBuilder: (_, index) => - SizedBox.square(dimension: kListViewSeparatorHeight), + const SizedBox.square(dimension: kListViewSeparatorHeight), itemCount: items.length, ); } diff --git a/packages/reown_appkit/lib/modal/widgets/miscellaneous/content_loading.dart b/packages/reown_appkit/lib/modal/widgets/miscellaneous/content_loading.dart index 95cb19cf..aff9f2a8 100644 --- a/packages/reown_appkit/lib/modal/widgets/miscellaneous/content_loading.dart +++ b/packages/reown_appkit/lib/modal/widgets/miscellaneous/content_loading.dart @@ -10,11 +10,8 @@ class ContentLoading extends StatelessWidget { return Container( padding: const EdgeInsets.all(8.0), height: viewHeight ?? 300.0, - child: Center( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: CircularLoader(), - ), + child: const Center( + child: Padding(padding: EdgeInsets.all(8.0), child: CircularLoader()), ), ); } diff --git a/packages/reown_appkit/lib/modal/widgets/miscellaneous/responsive_container.dart b/packages/reown_appkit/lib/modal/widgets/miscellaneous/responsive_container.dart index b4ee9782..7ac16715 100644 --- a/packages/reown_appkit/lib/modal/widgets/miscellaneous/responsive_container.dart +++ b/packages/reown_appkit/lib/modal/widgets/miscellaneous/responsive_container.dart @@ -112,7 +112,7 @@ class ResponsiveData extends InheritedWidget { } static Size gridItemSzieOf(BuildContext context) { - return Size(kGridItemWidth, kGridItemHeight); + return const Size(kGridItemWidth, kGridItemHeight); } @override diff --git a/packages/reown_appkit/lib/modal/widgets/miscellaneous/searchbar.dart b/packages/reown_appkit/lib/modal/widgets/miscellaneous/searchbar.dart index e5da2611..747d54d0 100644 --- a/packages/reown_appkit/lib/modal/widgets/miscellaneous/searchbar.dart +++ b/packages/reown_appkit/lib/modal/widgets/miscellaneous/searchbar.dart @@ -74,7 +74,7 @@ class _ModalSearchBarState extends State final _debouncer = Debouncer(milliseconds: 300); late DecorationTween _decorationTween = DecorationTween( - begin: BoxDecoration( + begin: const BoxDecoration( boxShadow: [ BoxShadow( color: Colors.transparent, @@ -85,7 +85,7 @@ class _ModalSearchBarState extends State ), ], ), - end: BoxDecoration( + end: const BoxDecoration( boxShadow: [ BoxShadow( color: Colors.transparent, @@ -127,7 +127,7 @@ class _ModalSearchBarState extends State ? BorderRadius.circular(widget.height) : BorderRadius.circular(widget.height * 0.4)), boxShadow: [ - BoxShadow( + const BoxShadow( color: Colors.transparent, offset: Offset.zero, blurRadius: 0.0, diff --git a/packages/reown_appkit/lib/modal/widgets/miscellaneous/segmented_control.dart b/packages/reown_appkit/lib/modal/widgets/miscellaneous/segmented_control.dart index 627b959f..e6eabf84 100644 --- a/packages/reown_appkit/lib/modal/widgets/miscellaneous/segmented_control.dart +++ b/packages/reown_appkit/lib/modal/widgets/miscellaneous/segmented_control.dart @@ -100,17 +100,17 @@ class _SegmentedControlState extends State { decoration: BoxDecoration( color: themeColors.grayGlass002, borderRadius: radiuses.isSquare() - ? BorderRadius.all(Radius.zero) + ? const BorderRadius.all(Radius.zero) : BorderRadius.circular(16.0), ), thumbDecoration: BoxDecoration( color: themeColors.grayGlass002, borderRadius: radiuses.isSquare() - ? BorderRadius.all(Radius.zero) + ? const BorderRadius.all(Radius.zero) : BorderRadius.circular(16.0), border: Border.all(color: themeColors.grayGlass002, width: 1), ), - duration: Duration(milliseconds: 200), + duration: const Duration(milliseconds: 200), curve: Curves.linear, onValueChanged: (value) { setState(() { diff --git a/packages/reown_appkit/lib/modal/widgets/miscellaneous/verify_otp_view.dart b/packages/reown_appkit/lib/modal/widgets/miscellaneous/verify_otp_view.dart index d2828474..8064e465 100644 --- a/packages/reown_appkit/lib/modal/widgets/miscellaneous/verify_otp_view.dart +++ b/packages/reown_appkit/lib/modal/widgets/miscellaneous/verify_otp_view.dart @@ -59,7 +59,7 @@ class _VerifyOtpViewState extends State void initState() { super.initState(); WidgetsBinding.instance.addObserver(this); - _resendEnabledAt = DateTime.now().add(Duration(seconds: 30)); + _resendEnabledAt = DateTime.now().add(const Duration(seconds: 30)); _focusNodes.first.requestFocus(); for (var fn in _focusNodes) { fn.addListener(_focusListener); @@ -78,7 +78,7 @@ class _VerifyOtpViewState extends State } else { final email = widget.currentEmail; widget.resendEmail(value: email); - _resendEnabledAt = DateTime.now().add(Duration(seconds: 30)); + _resendEnabledAt = DateTime.now().add(const Duration(seconds: 30)); GetIt.I().show( ToastMessage(type: ToastType.success, text: 'Code email resent'), ); @@ -224,7 +224,7 @@ class _VerifyOtpViewState extends State final clipboardHasData = await Clipboard.hasStrings(); if (clipboardHasData) { final clipboardData = await Clipboard.getData(Clipboard.kTextPlain); - await Clipboard.setData(ClipboardData(text: '')); + await Clipboard.setData(const ClipboardData(text: '')); final code = clipboardData?.text ?? ''; if (code.isNotEmpty) { widget.verifyOtp(otp: code); diff --git a/packages/reown_appkit/lib/modal/widgets/navigation/navbar.dart b/packages/reown_appkit/lib/modal/widgets/navigation/navbar.dart index bb0e068e..4ec36510 100644 --- a/packages/reown_appkit/lib/modal/widgets/navigation/navbar.dart +++ b/packages/reown_appkit/lib/modal/widgets/navigation/navbar.dart @@ -63,7 +63,7 @@ class ModalNavbar extends StatelessWidget { child: ValueListenableBuilder( valueListenable: _widgetStack.onRenderScreen, builder: (context, render, _) { - if (!render) return SizedBox.shrink(); + if (!render) return const SizedBox.shrink(); return Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ diff --git a/packages/reown_appkit/lib/modal/widgets/public/appkit_modal_account_button.dart b/packages/reown_appkit/lib/modal/widgets/public/appkit_modal_account_button.dart index 09171197..289defc2 100644 --- a/packages/reown_appkit/lib/modal/widgets/public/appkit_modal_account_button.dart +++ b/packages/reown_appkit/lib/modal/widgets/public/appkit_modal_account_button.dart @@ -75,9 +75,9 @@ class _AppKitModalAccountButtonState extends State { void _approveSign(MagicRequestEvent? args) async { if (args?.request != null) { if (widget.appKitModal.isOpen) { - _widgetStack.push(ApproveTransactionPage()); + _widgetStack.push(const ApproveTransactionPage()); } else { - widget.appKitModal.openModalView(ApproveTransactionPage()); + widget.appKitModal.openModalView(const ApproveTransactionPage()); } } } @@ -87,11 +87,11 @@ class _AppKitModalAccountButtonState extends State { final isOpen = widget.appKitModal.isOpen; if (isOpen) { _widgetStack.popAllAndPush( - SocialLoginPage(socialOption: AppKitSocialOption.Farcaster), + const SocialLoginPage(socialOption: AppKitSocialOption.Farcaster), ); } else { widget.appKitModal.openModalView( - SocialLoginPage(socialOption: AppKitSocialOption.Farcaster), + const SocialLoginPage(socialOption: AppKitSocialOption.Farcaster), ); } } @@ -206,11 +206,11 @@ class _BalanceButton extends StatelessWidget { mainAxisSize: MainAxisSize.min, children: [ appKit.status.isLoading - ? Row( + ? const Row( children: [ - const SizedBox.square(dimension: kPadding6), + SizedBox.square(dimension: kPadding6), CircularLoader(size: 16.0, strokeWidth: 1.5), - const SizedBox.square(dimension: kPadding6), + SizedBox.square(dimension: kPadding6), ], ) : tokenImage.isEmpty diff --git a/packages/reown_appkit/lib/modal/widgets/public/appkit_modal_address_button.dart b/packages/reown_appkit/lib/modal/widgets/public/appkit_modal_address_button.dart index aa76fe67..3e5ddfa4 100644 --- a/packages/reown_appkit/lib/modal/widgets/public/appkit_modal_address_button.dart +++ b/packages/reown_appkit/lib/modal/widgets/public/appkit_modal_address_button.dart @@ -42,16 +42,16 @@ class _AppKitModalAddressButtonState extends State { @override Widget build(BuildContext context) { if (widget.appKitModal.session == null) { - return SizedBox.shrink(); + return const SizedBox.shrink(); } final chainId = widget.appKitModal.selectedChain?.chainId ?? ''; if (chainId.isEmpty) { - return SizedBox.shrink(); + return const SizedBox.shrink(); } final namespace = NamespaceUtils.getNamespaceFromChain(chainId); final address = widget.appKitModal.session!.getAddress(namespace); if ((address ?? '').isEmpty) { - return SizedBox.shrink(); + return const SizedBox.shrink(); } final identityName = (widget.appKitModal.blockchainIdentity?.name ?? '').isNotEmpty @@ -105,9 +105,9 @@ class _AppKitModalAddressButtonState extends State { mainAxisSize: MainAxisSize.min, children: [ widget.appKitModal.status.isLoading - ? Row( + ? const Row( children: [ - const SizedBox.square(dimension: 4.0), + SizedBox.square(dimension: 4.0), CircularLoader(size: 16.0, strokeWidth: 1.5), ], ) @@ -128,7 +128,7 @@ class _AppKitModalAddressButtonState extends State { ), const SizedBox.square(dimension: 4.0), ConstrainedBox( - constraints: BoxConstraints(maxWidth: 140.0), + constraints: const BoxConstraints(maxWidth: 140.0), child: Text( identityName ?? RenderUtils.truncate( diff --git a/packages/reown_appkit/lib/modal/widgets/public/appkit_modal_balance_button.dart b/packages/reown_appkit/lib/modal/widgets/public/appkit_modal_balance_button.dart index 6c93ae57..16fdc9bf 100644 --- a/packages/reown_appkit/lib/modal/widgets/public/appkit_modal_balance_button.dart +++ b/packages/reown_appkit/lib/modal/widgets/public/appkit_modal_balance_button.dart @@ -90,11 +90,11 @@ class _AppKitModalBalanceButtonState extends State { mainAxisSize: MainAxisSize.min, children: [ widget.appKitModal.status.isLoading - ? Row( + ? const Row( children: [ - const SizedBox.square(dimension: kPadding6), + SizedBox.square(dimension: kPadding6), CircularLoader(size: 16.0, strokeWidth: 1.5), - const SizedBox.square(dimension: kPadding6), + SizedBox.square(dimension: kPadding6), ], ) : (_tokenImage ?? '').isEmpty diff --git a/packages/reown_appkit/lib/modal/widgets/toast/toast.dart b/packages/reown_appkit/lib/modal/widgets/toast/toast.dart index 356473fe..f78e13fd 100644 --- a/packages/reown_appkit/lib/modal/widgets/toast/toast.dart +++ b/packages/reown_appkit/lib/modal/widgets/toast/toast.dart @@ -59,7 +59,7 @@ class _ToastWidgetState extends State child: FadeTransition( opacity: _opacityAnimation, child: Container( - constraints: BoxConstraints(minHeight: 40.0), + constraints: const BoxConstraints(minHeight: 40.0), decoration: BoxDecoration( color: themeColors.background175, borderRadius: BorderRadius.circular(radiuses.radiusM), diff --git a/packages/reown_appkit/lib/solana/solana_web3/src/crypto/nacl.dart b/packages/reown_appkit/lib/solana/solana_web3/src/crypto/nacl.dart index ff870c2c..7c8ae176 100644 --- a/packages/reown_appkit/lib/solana/solana_web3/src/crypto/nacl.dart +++ b/packages/reown_appkit/lib/solana/solana_web3/src/crypto/nacl.dart @@ -27,8 +27,8 @@ const NaClSign sign = NaClSign(); @protected class NaClSign { const NaClSign(); - final keypair = const NaClKeypair(); - final detached = const NaClDetached(); + NaClKeypair get keypair => const NaClKeypair(); + NaClDetached get detached => const NaClDetached(); } /// NaCl Keypair diff --git a/packages/reown_appkit/lib/solana/solana_web3/src/rpc/methods/get_blocks_with_limit.dart b/packages/reown_appkit/lib/solana/solana_web3/src/rpc/methods/get_blocks_with_limit.dart index 21e89f59..e32ecae5 100644 --- a/packages/reown_appkit/lib/solana/solana_web3/src/rpc/methods/get_blocks_with_limit.dart +++ b/packages/reown_appkit/lib/solana/solana_web3/src/rpc/methods/get_blocks_with_limit.dart @@ -19,6 +19,6 @@ class GetBlocksWithLimit extends JsonRpcListTypeMethod { }) : super( 'getBlocksWithLimit', values: [startSlot, limit], - config: config ?? GetBlocksWithLimitConfig(), + config: config ?? const GetBlocksWithLimitConfig(), ); } diff --git a/packages/reown_appkit/lib/solana/solana_web3/src/rpc/methods/send_transaction.dart b/packages/reown_appkit/lib/solana/solana_web3/src/rpc/methods/send_transaction.dart index 00edad84..33d3713f 100644 --- a/packages/reown_appkit/lib/solana/solana_web3/src/rpc/methods/send_transaction.dart +++ b/packages/reown_appkit/lib/solana/solana_web3/src/rpc/methods/send_transaction.dart @@ -17,6 +17,6 @@ class SendTransaction extends JsonRpcTypeMethod { }) : super( 'sendTransaction', values: [signedTransaction], - config: config ?? SendTransactionConfig(), + config: config ?? const SendTransactionConfig(), ); } diff --git a/packages/reown_appkit/lib/solana/solana_web3/src/rpc/methods/simulate_transaction.dart b/packages/reown_appkit/lib/solana/solana_web3/src/rpc/methods/simulate_transaction.dart index 83df216b..370a0513 100644 --- a/packages/reown_appkit/lib/solana/solana_web3/src/rpc/methods/simulate_transaction.dart +++ b/packages/reown_appkit/lib/solana/solana_web3/src/rpc/methods/simulate_transaction.dart @@ -19,7 +19,7 @@ class SimulateTransaction }) : super( 'simulateTransaction', values: [signedTransaction], - config: config ?? SimulateTransactionConfig(), + config: config ?? const SimulateTransactionConfig(), ); @override diff --git a/packages/reown_appkit/pubspec.yaml b/packages/reown_appkit/pubspec.yaml index 082afe56..5e7adab2 100644 --- a/packages/reown_appkit/pubspec.yaml +++ b/packages/reown_appkit/pubspec.yaml @@ -30,8 +30,10 @@ dependencies: pinenacl: ^0.6.0 plugin_platform_interface: ^2.1.8 qr_flutter_wc: ^0.0.3 - reown_core: ^1.3.8 - reown_sign: ^1.3.9 + reown_core: + path: ../reown_core/ + reown_sign: + path: ../reown_sign/ shimmer: ^3.0.0 synchronized: ^3.3.0+3 web_socket_channel: ^3.0.1 @@ -51,7 +53,8 @@ dev_dependencies: logger: ^2.5.0 mockito: ^5.4.4 package_info_plus: '>=8.1.2 <10.0.0' - reown_walletkit: ^1.4.0 + reown_walletkit: + path: ../reown_walletkit/ # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec diff --git a/packages/reown_appkit/test/services/dwe/dwe_service_transfers_test.dart b/packages/reown_appkit/test/services/dwe/dwe_service_transfers_test.dart index ffb6425b..735de51e 100644 --- a/packages/reown_appkit/test/services/dwe/dwe_service_transfers_test.dart +++ b/packages/reown_appkit/test/services/dwe/dwe_service_transfers_test.dart @@ -21,7 +21,7 @@ void main() { setUpAll(() { provideDummy( - GetQuoteStatusResult(status: QuoteStatus.waiting), + const GetQuoteStatusResult(status: QuoteStatus.waiting), ); }); @@ -50,7 +50,7 @@ void main() { when( mockTransfersService.getQuoteStatus(params: anyNamed('params')), ).thenAnswer( - (_) async => GetQuoteStatusResult(status: QuoteStatus.waiting), + (_) async => const GetQuoteStatusResult(status: QuoteStatus.waiting), ); dweService = DWEService(appKit: mockAppKit); @@ -75,7 +75,7 @@ void main() { when( mockTransfersService.getQuoteStatus(params: anyNamed('params')), ).thenAnswer( - (_) async => GetQuoteStatusResult(status: QuoteStatus.success), + (_) async => const GetQuoteStatusResult(status: QuoteStatus.success), ); dweService.loopOnTransferStatusCheck('exchange-id', 'request-id', ( @@ -120,9 +120,9 @@ void main() { ).thenAnswer((_) async { callCount++; if (callCount < 3) { - return GetQuoteStatusResult(status: QuoteStatus.waiting); + return const GetQuoteStatusResult(status: QuoteStatus.waiting); } - return GetQuoteStatusResult(status: QuoteStatus.success); + return const GetQuoteStatusResult(status: QuoteStatus.success); }); final completer = Completer<(QuoteStatus, dynamic)>(); @@ -170,9 +170,9 @@ void main() { ).thenAnswer((_) async { callCount++; if (callCount < 3) { - return GetQuoteStatusResult(status: QuoteStatus.pending); + return const GetQuoteStatusResult(status: QuoteStatus.pending); } - return GetQuoteStatusResult(status: QuoteStatus.success); + return const GetQuoteStatusResult(status: QuoteStatus.success); }); final completer = Completer<(QuoteStatus, dynamic)>(); @@ -208,7 +208,7 @@ void main() { when( mockTransfersService.getQuoteStatus(params: anyNamed('params')), ).thenAnswer( - (_) async => GetQuoteStatusResult(status: QuoteStatus.failure), + (_) async => const GetQuoteStatusResult(status: QuoteStatus.failure), ); dweService.loopOnTransferStatusCheck('exchange-id', 'request-id', ( @@ -234,7 +234,8 @@ void main() { when( mockTransfersService.getQuoteStatus(params: anyNamed('params')), ).thenAnswer( - (_) async => GetQuoteStatusResult(status: QuoteStatus.waiting), + (_) async => + const GetQuoteStatusResult(status: QuoteStatus.waiting), ); final completer = Completer<(QuoteStatus, dynamic)>(); @@ -273,7 +274,7 @@ void main() { when( mockTransfersService.getQuoteStatus(params: anyNamed('params')), ).thenAnswer( - (_) async => GetQuoteStatusResult(status: QuoteStatus.waiting), + (_) async => const GetQuoteStatusResult(status: QuoteStatus.waiting), ); dweService.loopOnTransferStatusCheck('exchange-id', 'request-id', ( @@ -302,7 +303,7 @@ void main() { when( mockTransfersService.getQuoteStatus(params: anyNamed('params')), ).thenAnswer( - (_) async => GetQuoteStatusResult(status: QuoteStatus.waiting), + (_) async => const GetQuoteStatusResult(status: QuoteStatus.waiting), ); dweService.loopOnTransferStatusCheck('exchange-id', 'request-id', ( @@ -356,7 +357,7 @@ void main() { when( mockTransfersService.getQuoteStatus(params: anyNamed('params')), ).thenAnswer( - (_) async => GetQuoteStatusResult(status: QuoteStatus.success), + (_) async => const GetQuoteStatusResult(status: QuoteStatus.success), ); final completer = Completer<(QuoteStatus, dynamic)>(); @@ -387,7 +388,7 @@ void main() { when( mockTransfersService.getQuoteStatus(params: anyNamed('params')), ).thenAnswer( - (_) async => GetQuoteStatusResult(status: QuoteStatus.waiting), + (_) async => const GetQuoteStatusResult(status: QuoteStatus.waiting), ); dweService.loopOnTransferStatusCheck('exchange-id', 'request-id', ( diff --git a/packages/reown_appkit/test/services/transfers/quote_models_test.dart b/packages/reown_appkit/test/services/transfers/quote_models_test.dart index 49ef1c14..0ff4db6c 100644 --- a/packages/reown_appkit/test/services/transfers/quote_models_test.dart +++ b/packages/reown_appkit/test/services/transfers/quote_models_test.dart @@ -111,7 +111,7 @@ void main() { group('QuoteFeeExtension', () { test('formats fee correctly', () { - final fee = QuoteFee( + final fee = const QuoteFee( id: 'service', label: 'Service Fee', amount: '1000000000000000000', // 1 ETH with 18 decimals @@ -124,7 +124,7 @@ void main() { }); test('formats small fee correctly', () { - final fee = QuoteFee( + final fee = const QuoteFee( id: 'service', label: 'Service Fee', amount: '1000000', // 1 USDC with 6 decimals @@ -139,7 +139,7 @@ void main() { group('QuoteExtension', () { test('formats amount with symbol', () { - final quote = Quote( + final quote = const Quote( type: QuoteType.directTransfer, origin: QuoteAmount( amount: '1000000000000000000', // 1 ETH @@ -160,7 +160,7 @@ void main() { }); test('formats amount without symbol', () { - final quote = Quote( + final quote = const Quote( type: QuoteType.directTransfer, origin: QuoteAmount( amount: '1000000000000000000', // 1 ETH @@ -190,7 +190,7 @@ void main() { group('QuoteStepExtension', () { test('identifies deposit step correctly', () { - final step = QuoteStep.deposit( + final step = const QuoteStep.deposit( requestId: 'test-id', deposit: QuoteDeposit( amount: '1000000000000000000', @@ -204,7 +204,7 @@ void main() { }); test('identifies transaction step correctly', () { - final step = QuoteStep.transaction( + final step = const QuoteStep.transaction( requestId: 'test-id', transaction: {'type': 'transfer'}, ); diff --git a/packages/reown_appkit/test/services/transfers/quote_params_test.dart b/packages/reown_appkit/test/services/transfers/quote_params_test.dart index f6b5b4fa..8bc2a975 100644 --- a/packages/reown_appkit/test/services/transfers/quote_params_test.dart +++ b/packages/reown_appkit/test/services/transfers/quote_params_test.dart @@ -5,7 +5,7 @@ import 'package:reown_appkit/modal/services/transfers/models/quote_params.dart'; void main() { group('GetQuoteParams', () { test('creates instance correctly', () { - final params = GetQuoteParams( + final params = const GetQuoteParams( sourceToken: ethereumETH, toToken: solanaSOL, recipient: '0x1234567890123456789012345678901234567890', @@ -21,7 +21,7 @@ void main() { }); test('creates instance without optional address', () { - final params = GetQuoteParams( + final params = const GetQuoteParams( sourceToken: ethereumETH, toToken: ethereumUSDC, recipient: '0x1234567890123456789012345678901234567890', @@ -32,7 +32,7 @@ void main() { }); test('serializes to JSON correctly', () { - final params = GetQuoteParams( + final params = const GetQuoteParams( sourceToken: ethereumETH, toToken: ethereumUSDC, recipient: '0x1234567890123456789012345678901234567890', @@ -76,7 +76,7 @@ void main() { group('GetTransfersQuoteParams', () { test('creates instance correctly', () { - final params = GetTransfersQuoteParams( + final params = const GetTransfersQuoteParams( user: '0x1234567890123456789012345678901234567890', originChainId: '1', originCurrency: 'native', @@ -99,7 +99,7 @@ void main() { }); test('creates instance without optional user', () { - final params = GetTransfersQuoteParams( + final params = const GetTransfersQuoteParams( originChainId: '1', originCurrency: 'native', destinationChainId: '137', @@ -112,7 +112,7 @@ void main() { }); test('serializes to JSON correctly', () { - final params = GetTransfersQuoteParams( + final params = const GetTransfersQuoteParams( user: '0x1234567890123456789012345678901234567890', originChainId: '1', originCurrency: 'native', @@ -136,7 +136,7 @@ void main() { }); test('excludes null user from JSON', () { - final params = GetTransfersQuoteParams( + final params = const GetTransfersQuoteParams( originChainId: '1', originCurrency: 'native', destinationChainId: '137', @@ -152,13 +152,17 @@ void main() { group('GetQuoteStatusParams', () { test('creates instance correctly', () { - final params = GetQuoteStatusParams(requestId: 'test-request-id-123'); + final params = const GetQuoteStatusParams( + requestId: 'test-request-id-123', + ); expect(params.requestId, 'test-request-id-123'); }); test('serializes to JSON correctly', () { - final params = GetQuoteStatusParams(requestId: 'test-request-id-123'); + final params = const GetQuoteStatusParams( + requestId: 'test-request-id-123', + ); final json = params.toJson(); expect(json['requestId'], 'test-request-id-123'); diff --git a/packages/reown_appkit/test/services/transfers/quote_results_test.dart b/packages/reown_appkit/test/services/transfers/quote_results_test.dart index 2684a5d8..da0df944 100644 --- a/packages/reown_appkit/test/services/transfers/quote_results_test.dart +++ b/packages/reown_appkit/test/services/transfers/quote_results_test.dart @@ -6,13 +6,13 @@ import 'package:reown_appkit/modal/services/transfers/models/quote_results.dart' void main() { group('GetQuoteStatusResult', () { test('creates instance correctly', () { - final result = GetQuoteStatusResult(status: QuoteStatus.success); + final result = const GetQuoteStatusResult(status: QuoteStatus.success); expect(result.status, QuoteStatus.success); }); test('serializes to JSON correctly', () { - final result = GetQuoteStatusResult(status: QuoteStatus.pending); + final result = const GetQuoteStatusResult(status: QuoteStatus.pending); final json = result.toJson(); expect(json['status'], 'pending'); @@ -45,7 +45,7 @@ void main() { group('GetExchangeAssetsResult', () { test('creates instance correctly', () { - final result = GetExchangeAssetsResult( + final result = const GetExchangeAssetsResult( exchangeId: 'binance', assets: { 'eip155:1': [ethereumETH, ethereumUSDC], @@ -60,7 +60,7 @@ void main() { }); test('serializes to JSON correctly', () { - final result = GetExchangeAssetsResult( + final result = const GetExchangeAssetsResult( exchangeId: 'binance', assets: { 'eip155:1': [ethereumETH], @@ -94,7 +94,7 @@ void main() { }); test('handles empty assets map', () { - final result = GetExchangeAssetsResult( + final result = const GetExchangeAssetsResult( exchangeId: 'coinbase', assets: {}, ); @@ -105,7 +105,7 @@ void main() { group('GetQuoteResult (Quote)', () { test('creates quote instance correctly', () { - final quote = Quote( + final quote = const Quote( type: QuoteType.directTransfer, origin: QuoteAmount( amount: '1000000000000000000', @@ -142,7 +142,7 @@ void main() { }); test('serializes to JSON correctly', () { - final quote = Quote( + final quote = const Quote( type: QuoteType.directTransfer, origin: QuoteAmount( amount: '1000000000000000000', diff --git a/packages/reown_appkit/test/services/transfers/transfers_service_test.dart b/packages/reown_appkit/test/services/transfers/transfers_service_test.dart index 76444793..54eaf125 100644 --- a/packages/reown_appkit/test/services/transfers/transfers_service_test.dart +++ b/packages/reown_appkit/test/services/transfers/transfers_service_test.dart @@ -35,7 +35,7 @@ void main() { test( 'returns direct transfer quote for same chain and same asset', () async { - final params = GetQuoteParams( + final params = const GetQuoteParams( sourceToken: ethereumETH, toToken: ethereumETH, recipient: '0x1234567890123456789012345678901234567890', @@ -108,7 +108,7 @@ void main() { }); test('calls transfers API for different chain', () async { - final params = GetQuoteParams( + final params = const GetQuoteParams( sourceToken: ethereumETH, toToken: solanaSOL, recipient: 'CbKGgVKLJFb8bBrf58DnAkdryX6ubewVytn7X957YwNr', @@ -119,7 +119,7 @@ void main() { // Mock HTTP response would go here if we had HTTP mocking // For now, we verify the logic that determines which path to take // ignore: unused_local_variable - final _mockResponse = http.Response( + final mockResponse = http.Response( jsonEncode({ 'type': 'direct-transfer', 'origin': { @@ -184,7 +184,7 @@ void main() { }); test('calls transfers API for same chain but different asset', () async { - final params = GetQuoteParams( + final params = const GetQuoteParams( sourceToken: ethereumETH, toToken: ethereumUSDC, recipient: '0x1234567890123456789012345678901234567890', @@ -204,7 +204,7 @@ void main() { group('getQuoteStatus', () { test('returns quote status successfully', () async { - final params = GetQuoteStatusParams(requestId: 'test-request-id'); + final params = const GetQuoteStatusParams(requestId: 'test-request-id'); // Note: This test demonstrates the expected behavior. // In a real implementation, we'd need to mock http.get @@ -215,7 +215,7 @@ void main() { test('throws exception on API error response', () async { // Verify error handling structure would be tested with mocked HTTP // For now, we verify the params structure - final params = GetQuoteStatusParams(requestId: 'test-request-id'); + final params = const GetQuoteStatusParams(requestId: 'test-request-id'); expect(params.requestId, 'test-request-id'); }); }); diff --git a/packages/reown_cli/analysis_options.yaml b/packages/reown_cli/analysis_options.yaml index b677fc6a..ac988f21 100644 --- a/packages/reown_cli/analysis_options.yaml +++ b/packages/reown_cli/analysis_options.yaml @@ -29,6 +29,9 @@ linter: sort_pub_dependencies: true avoid_unnecessary_containers: true cancel_subscriptions: true + prefer_const_constructors: true + # prefer_const_literals_to_create_immutables: true + avoid_field_initializers_in_const_classes: true analyzer: exclude: diff --git a/packages/reown_core/analysis_options.yaml b/packages/reown_core/analysis_options.yaml index b677fc6a..ac988f21 100644 --- a/packages/reown_core/analysis_options.yaml +++ b/packages/reown_core/analysis_options.yaml @@ -29,6 +29,9 @@ linter: sort_pub_dependencies: true avoid_unnecessary_containers: true cancel_subscriptions: true + prefer_const_constructors: true + # prefer_const_literals_to_create_immutables: true + avoid_field_initializers_in_const_classes: true analyzer: exclude: diff --git a/packages/reown_core/lib/core_impl.dart b/packages/reown_core/lib/core_impl.dart index 22fa9677..a870597f 100644 --- a/packages/reown_core/lib/core_impl.dart +++ b/packages/reown_core/lib/core_impl.dart @@ -262,7 +262,7 @@ class ReownCore implements IReownCore { @override void confirmOnlineStateOrThrow() { if (!connectivity.isOnline.value) { - throw ReownCoreError(code: -1, message: 'No internet connection'); + throw const ReownCoreError(code: -1, message: 'No internet connection'); } } } diff --git a/packages/reown_core/lib/events/models/basic_event.dart b/packages/reown_core/lib/events/models/basic_event.dart index 94751d26..cd67a58e 100644 --- a/packages/reown_core/lib/events/models/basic_event.dart +++ b/packages/reown_core/lib/events/models/basic_event.dart @@ -90,101 +90,103 @@ class CoreEventEvent { class _ErrorOptions { const _ErrorOptions(); - final NO_WSS_CONNECTION = 'NO_WSS_CONNECTION'; - final NO_INTERNET_CONNECTION = 'NO_INTERNET_CONNECTION'; - final MALFORMED_PAIRING_URI = 'MALFORMED_PAIRING_URI'; - final PAIRING_ALREADY_EXIST = 'PAIRING_ALREADY_EXIST'; - final PAIRING_SUBSCRIPTION_FAILURE = 'FAILED_TO_SUBSCRIBE_TO_PAIRING_TOPIC'; - final PAIRING_URI_EXPIRED = 'PAIRING_URI_EXPIRED'; - final PAIRING_EXPIRED = 'PAIRING_EXPIRED'; - final PROPOSAL_EXPIRED = 'PROPOSAL_EXPIRED'; - final SESSION_SUBSCRIPTION_FAILURE = 'SESSION_SUBSCRIPTION_FAILURE'; - final SESSION_APPROVE_PUBLISH_FAILURE = 'SESSION_APPROVE_PUBLISH_FAILURE'; - final SESSION_SETTLE_PUBLISH_FAILURE = 'SESSION_SETTLE_PUBLISH_FAILURE'; - final SESSION_APPROVE_NAMESPACE_VALIDATION_FAILURE = + String get NO_WSS_CONNECTION => 'NO_WSS_CONNECTION'; + String get NO_INTERNET_CONNECTION => 'NO_INTERNET_CONNECTION'; + String get MALFORMED_PAIRING_URI => 'MALFORMED_PAIRING_URI'; + String get PAIRING_ALREADY_EXIST => 'PAIRING_ALREADY_EXIST'; + String get PAIRING_SUBSCRIPTION_FAILURE => + 'FAILED_TO_SUBSCRIBE_TO_PAIRING_TOPIC'; + String get PAIRING_URI_EXPIRED => 'PAIRING_URI_EXPIRED'; + String get PAIRING_EXPIRED => 'PAIRING_EXPIRED'; + String get PROPOSAL_EXPIRED => 'PROPOSAL_EXPIRED'; + String get SESSION_SUBSCRIPTION_FAILURE => 'SESSION_SUBSCRIPTION_FAILURE'; + String get SESSION_APPROVE_PUBLISH_FAILURE => + 'SESSION_APPROVE_PUBLISH_FAILURE'; + String get SESSION_SETTLE_PUBLISH_FAILURE => 'SESSION_SETTLE_PUBLISH_FAILURE'; + String get SESSION_APPROVE_NAMESPACE_VALIDATION_FAILURE => 'SESSION_APPROVE_NAMESPACE_VALIDATION_FAILURE'; - final REQUIRED_NAMESPACE_VALIDATION_FAILURE = + String get REQUIRED_NAMESPACE_VALIDATION_FAILURE => 'REQUIRED_NAMESPACE_VALIDATION_FAILURE'; - final OPTIONAL_NAMESPACE_VALIDATION_FAILURE = + String get OPTIONAL_NAMESPACE_VALIDATION_FAILURE => 'OPTIONAL_NAMESPACE_VALIDATION_FAILURE'; - final SESSION_PROPERTIES_VALIDATION_FAILURE = + String get SESSION_PROPERTIES_VALIDATION_FAILURE => 'SESSION_PROPERTIES_VALIDATION_FAILURE'; - final MISSING_SESSION_AUTH_REQUEST = 'MISSING_SESSION_AUTH_REQUEST'; - final SESSION_AUTH_REQUEST_EXPIRED = 'SESSION_AUTH_REQUEST_EXPIRED'; - final CHAINS_CAIP2_COMPLIANT_FAILURE = 'CHAINS_CAIP2_COMPLIANT_FAILURE'; - final CHAINS_EVM_COMPLIANT_FAILURE = 'CHAINS_EVM_COMPLIANT_FAILURE'; - final INVALID_CACAO = 'INVALID_CACAO'; - final SUBSCRIBE_AUTH_SESSION_TOPIC_FAILURE = + String get MISSING_SESSION_AUTH_REQUEST => 'MISSING_SESSION_AUTH_REQUEST'; + String get SESSION_AUTH_REQUEST_EXPIRED => 'SESSION_AUTH_REQUEST_EXPIRED'; + String get CHAINS_CAIP2_COMPLIANT_FAILURE => 'CHAINS_CAIP2_COMPLIANT_FAILURE'; + String get CHAINS_EVM_COMPLIANT_FAILURE => 'CHAINS_EVM_COMPLIANT_FAILURE'; + String get INVALID_CACAO => 'INVALID_CACAO'; + String get SUBSCRIBE_AUTH_SESSION_TOPIC_FAILURE => 'SUBSCRIBE_AUTH_SESSION_TOPIC_FAILURE'; - final AUTHENTICATED_SESSION_APPROVE_PUBLISH_FAILURE = + String get AUTHENTICATED_SESSION_APPROVE_PUBLISH_FAILURE => 'AUTHENTICATED_SESSION_APPROVE_PUBLISH_FAILURE'; - final AUTHENTICATED_SESSION_EXPIRED = 'AUTHENTICATED_SESSION_EXPIRED'; + String get AUTHENTICATED_SESSION_EXPIRED => 'AUTHENTICATED_SESSION_EXPIRED'; } class _ModalTrackOptions { const _ModalTrackOptions(); // basic - final MODAL_CREATED = 'MODAL_CREATED'; - final MODAL_LOADED = 'MODAL_LOADED'; - final MODAL_OPEN = 'MODAL_OPEN'; - final MODAL_CLOSE = 'MODAL_CLOSE'; - final CLICK_ALL_WALLETS = 'CLICK_ALL_WALLETS'; - final CLICK_NETWORKS = 'CLICK_NETWORKS'; - final SWITCH_NETWORK = 'SWITCH_NETWORK'; - final SELECT_WALLET = 'SELECT_WALLET'; - final CONNECT_SUCCESS = 'CONNECT_SUCCESS'; - final CONNECT_ERROR = 'CONNECT_ERROR'; - final DISCONNECT_SUCCESS = 'DISCONNECT_SUCCESS'; - final DISCONNECT_ERROR = 'DISCONNECT_ERROR'; - final CLICK_WALLET_HELP = 'CLICK_WALLET_HELP'; - final CLICK_NETWORK_HELP = 'CLICK_NETWORK_HELP'; - final CLICK_GET_WALLET_HELP = 'CLICK_GET_WALLET_HELP'; - final GET_WALLET = 'GET_WALLET'; - final WALLET_IMPRESSION = 'WALLET_IMPRESSION'; - final INITIALIZE = 'INITIALIZE'; - final USER_REJECTED = 'USER_REJECTED'; + String get MODAL_CREATED => 'MODAL_CREATED'; + String get MODAL_LOADED => 'MODAL_LOADED'; + String get MODAL_OPEN => 'MODAL_OPEN'; + String get MODAL_CLOSE => 'MODAL_CLOSE'; + String get CLICK_ALL_WALLETS => 'CLICK_ALL_WALLETS'; + String get CLICK_NETWORKS => 'CLICK_NETWORKS'; + String get SWITCH_NETWORK => 'SWITCH_NETWORK'; + String get SELECT_WALLET => 'SELECT_WALLET'; + String get CONNECT_SUCCESS => 'CONNECT_SUCCESS'; + String get CONNECT_ERROR => 'CONNECT_ERROR'; + String get DISCONNECT_SUCCESS => 'DISCONNECT_SUCCESS'; + String get DISCONNECT_ERROR => 'DISCONNECT_ERROR'; + String get CLICK_WALLET_HELP => 'CLICK_WALLET_HELP'; + String get CLICK_NETWORK_HELP => 'CLICK_NETWORK_HELP'; + String get CLICK_GET_WALLET_HELP => 'CLICK_GET_WALLET_HELP'; + String get GET_WALLET => 'GET_WALLET'; + String get WALLET_IMPRESSION => 'WALLET_IMPRESSION'; + String get INITIALIZE => 'INITIALIZE'; + String get USER_REJECTED => 'USER_REJECTED'; // email login - final EMAIL_LOGIN_SELECTED = 'EMAIL_LOGIN_SELECTED'; - final EMAIL_SUBMITTED = 'EMAIL_SUBMITTED'; - final DEVICE_REGISTERED_FOR_EMAIL = 'DEVICE_REGISTERED_FOR_EMAIL'; - final EMAIL_VERIFICATION_CODE_SENT = 'EMAIL_VERIFICATION_CODE_SENT'; - final EMAIL_VERIFICATION_CODE_PASS = 'EMAIL_VERIFICATION_CODE_PASS'; - final EMAIL_VERIFICATION_CODE_FAIL = 'EMAIL_VERIFICATION_CODE_FAIL'; - final EMAIL_EDIT = 'EMAIL_EDIT'; - final EMAIL_EDIT_COMPLETE = 'EMAIL_EDIT_COMPLETE'; - final EMAIL_UPGRADE_FROM_MODAL = 'EMAIL_UPGRADE_FROM_MODAL'; + String get EMAIL_LOGIN_SELECTED => 'EMAIL_LOGIN_SELECTED'; + String get EMAIL_SUBMITTED => 'EMAIL_SUBMITTED'; + String get DEVICE_REGISTERED_FOR_EMAIL => 'DEVICE_REGISTERED_FOR_EMAIL'; + String get EMAIL_VERIFICATION_CODE_SENT => 'EMAIL_VERIFICATION_CODE_SENT'; + String get EMAIL_VERIFICATION_CODE_PASS => 'EMAIL_VERIFICATION_CODE_PASS'; + String get EMAIL_VERIFICATION_CODE_FAIL => 'EMAIL_VERIFICATION_CODE_FAIL'; + String get EMAIL_EDIT => 'EMAIL_EDIT'; + String get EMAIL_EDIT_COMPLETE => 'EMAIL_EDIT_COMPLETE'; + String get EMAIL_UPGRADE_FROM_MODAL => 'EMAIL_UPGRADE_FROM_MODAL'; // siwe - final CLICK_SIGN_SIWE_MESSAGE = 'CLICK_SIGN_SIWE_MESSAGE'; - final CLICK_CANCEL_SIWE = 'CLICK_CANCEL_SIWE'; - final SIWE_AUTH_SUCCESS = 'SIWE_AUTH_SUCCESS'; - final SIWE_AUTH_ERROR = 'SIWE_AUTH_ERROR'; + String get CLICK_SIGN_SIWE_MESSAGE => 'CLICK_SIGN_SIWE_MESSAGE'; + String get CLICK_CANCEL_SIWE => 'CLICK_CANCEL_SIWE'; + String get SIWE_AUTH_SUCCESS => 'SIWE_AUTH_SUCCESS'; + String get SIWE_AUTH_ERROR => 'SIWE_AUTH_ERROR'; // smart accounts - final SET_PREFERRED_ACCOUNT_TYPE = 'SET_PREFERRED_ACCOUNT_TYPE'; + String get SET_PREFERRED_ACCOUNT_TYPE => 'SET_PREFERRED_ACCOUNT_TYPE'; // social - final SOCIAL_LOGIN_STARTED = 'SOCIAL_LOGIN_STARTED'; - final SOCIAL_LOGIN_SUCCESS = 'SOCIAL_LOGIN_SUCCESS'; - final SOCIAL_LOGIN_ERROR = 'SOCIAL_LOGIN_ERROR'; - final SOCIAL_LOGIN_REQUEST_USER_DATA = 'SOCIAL_LOGIN_REQUEST_USER_DATA'; - final SOCIAL_LOGIN_CANCELED = 'SOCIAL_LOGIN_CANCELED'; + String get SOCIAL_LOGIN_STARTED => 'SOCIAL_LOGIN_STARTED'; + String get SOCIAL_LOGIN_SUCCESS => 'SOCIAL_LOGIN_SUCCESS'; + String get SOCIAL_LOGIN_ERROR => 'SOCIAL_LOGIN_ERROR'; + String get SOCIAL_LOGIN_REQUEST_USER_DATA => 'SOCIAL_LOGIN_REQUEST_USER_DATA'; + String get SOCIAL_LOGIN_CANCELED => 'SOCIAL_LOGIN_CANCELED'; // wallet features - final OPEN_SEND = 'OPEN_SEND'; - final SEND_INITIATED = 'SEND_INITIATED'; - final SEND_SUCCESS = 'SEND_SUCCESS'; - final SEND_ERROR = 'SEND_ERROR'; + String get OPEN_SEND => 'OPEN_SEND'; + String get SEND_INITIATED => 'SEND_INITIATED'; + String get SEND_SUCCESS => 'SEND_SUCCESS'; + String get SEND_ERROR => 'SEND_ERROR'; // final SIGN_TRANSACTION = 'SIGN_TRANSACTION'; // Transactions History - final CLICK_TRANSACTIONS = 'CLICK_TRANSACTIONS'; - final ERROR_FETCH_TRANSACTIONS = 'ERROR_FETCH_TRANSACTIONS'; - final LOAD_MORE_TRANSACTIONS = 'LOAD_MORE_TRANSACTIONS'; + String get CLICK_TRANSACTIONS => 'CLICK_TRANSACTIONS'; + String get ERROR_FETCH_TRANSACTIONS => 'ERROR_FETCH_TRANSACTIONS'; + String get LOAD_MORE_TRANSACTIONS => 'LOAD_MORE_TRANSACTIONS'; // fund from exchange - final PAY_EXCHANGE_SELECTED = 'PAY_EXCHANGE_SELECTED'; + String get PAY_EXCHANGE_SELECTED => 'PAY_EXCHANGE_SELECTED'; } diff --git a/packages/reown_core/lib/utils/polkadot_utils.dart b/packages/reown_core/lib/utils/polkadot_utils.dart index b120819d..57d17ac4 100644 --- a/packages/reown_core/lib/utils/polkadot_utils.dart +++ b/packages/reown_core/lib/utils/polkadot_utils.dart @@ -9,7 +9,7 @@ class PolkadotChainUtils { final decoded = base58.decode(ss58Address); if (decoded.length < 33) { - throw FormatException('Too short to contain a public key'); + throw const FormatException('Too short to contain a public key'); } return decoded.sublist(1, 33); diff --git a/packages/reown_core/lib/verify/verify.dart b/packages/reown_core/lib/verify/verify.dart index 02fe3be9..60b2d721 100644 --- a/packages/reown_core/lib/verify/verify.dart +++ b/packages/reown_core/lib/verify/verify.dart @@ -50,7 +50,9 @@ class Verify implements IVerify { '$_verifyUrl/attestation/$attestationId?v2Supported=true', ); _core.logger.d('[$runtimeType] resolve attestationId: $attestationId'); - final response = await _httpClient.get(uri).timeout(Duration(seconds: 5)); + final response = await _httpClient + .get(uri) + .timeout(const Duration(seconds: 5)); if (response.statusCode == 404 || response.body.isEmpty) { throw AttestationNotFound( code: 404, @@ -126,7 +128,9 @@ extension VerifyV2 on Verify { try { final url = Uri.parse('${Verify._verifyUrlV2}/public-key'); _core.logger.d('[$runtimeType] fetching public key from $url'); - final response = await _httpClient.get(url).timeout(Duration(seconds: 5)); + final response = await _httpClient + .get(url) + .timeout(const Duration(seconds: 5)); final pk = JWK.fromJson(jsonDecode(response.body)); final expDate = DateTime.fromMillisecondsSinceEpoch(pk.expiresAt * 1000); _core.logger.d('[$runtimeType] public key fetched: ${pk.toJson()}'); diff --git a/packages/reown_core/test/relay_client_test.dart b/packages/reown_core/test/relay_client_test.dart index 6b4f841f..4aea65d6 100644 --- a/packages/reown_core/test/relay_client_test.dart +++ b/packages/reown_core/test/relay_client_test.dart @@ -379,7 +379,7 @@ void main() { expect(() async { await coreDapp.relayClient.publishPayload( payload: payloadA, - options: PublishOptions( + options: const PublishOptions( publishMethod: RelayClient.WC_PROPOSE_SESSION, ), ); @@ -388,7 +388,7 @@ void main() { expect(() async { await coreWallet.relayClient.publishPayload( payload: payloadB, - options: PublishOptions( + options: const PublishOptions( publishMethod: RelayClient.WC_APPROVE_SESSION, ), ); @@ -481,7 +481,7 @@ void main() { const testMessage = 'test-message-456'; // Create PublishOptions with tvf data - final publishOptions = PublishOptions( + final publishOptions = const PublishOptions( ttl: 300, tag: 1109, correlationId: 1756879922616218, @@ -500,7 +500,7 @@ void main() { // Subscribe to the topic first await coreDapp.relayClient.subscribe( - options: SubscribeOptions(topic: testTopic), + options: const SubscribeOptions(topic: testTopic), ); // Test that publish can be called without throwing @@ -525,7 +525,7 @@ void main() { await coreDapp.pairing.activate(topic: response.topic); // Create PublishOptions with tvf data - final publishOptions = PublishOptions( + final publishOptions = const PublishOptions( ttl: 300, tag: 1109, correlationId: 1756879922616218, @@ -563,7 +563,7 @@ void main() { group('PublishOptions Parameter Structure Tests', () { test('PublishOptionsExtension.toMap() correctly structures tvf data', () { // Test case 1: PublishOptions with tvf data - final publishOptionsWithTvf = PublishOptions( + final publishOptionsWithTvf = const PublishOptions( ttl: 300, tag: 1109, correlationId: 1756879922616218, @@ -604,7 +604,7 @@ void main() { }); test('PublishOptionsExtension.toMap() handles null tvf data', () { - final publishOptionsWithoutTvf = PublishOptions( + final publishOptionsWithoutTvf = const PublishOptions( ttl: 300, tag: 1109, correlationId: 1756879922616218, @@ -629,7 +629,7 @@ void main() { }); test('PublishOptionsExtension.toMap() handles empty tvf data', () { - final publishOptionsWithEmptyTvf = PublishOptions( + final publishOptionsWithEmptyTvf = const PublishOptions( ttl: 300, tag: 1109, correlationId: 1756879922616218, @@ -654,7 +654,7 @@ void main() { }); test('PublishOptionsExtension.toMap() handles partial tvf data', () { - final publishOptionsWithPartialTvf = PublishOptions( + final publishOptionsWithPartialTvf = const PublishOptions( ttl: 300, tag: 1109, correlationId: 1756879922616218, @@ -685,7 +685,7 @@ void main() { // This test verifies that the PublishOptions.toMap() method produces // the correct parameter structure that matches the expected JSON-RPC format - final publishOptions = PublishOptions( + final publishOptions = const PublishOptions( ttl: 300, tag: 1109, correlationId: 1756879922616218, @@ -753,7 +753,7 @@ void main() { // This test verifies the complete JSON-RPC request structure and will catch // if someone accidentally changes the implementation to nest tvf data under a 'tvf' key - final publishOptions = PublishOptions( + final publishOptions = const PublishOptions( ttl: 300, tag: 1109, correlationId: 1756879922616218, @@ -882,7 +882,7 @@ void main() { 'pairingTopic': pairingTopic, 'sessionProposal': sessionProposal, }, - options: PublishOptions( + options: const PublishOptions( correlationId: correlationId, publishMethod: RelayClient.WC_PROPOSE_SESSION, ), @@ -906,7 +906,7 @@ void main() { 'pairingTopic': pairingTopic, 'sessionProposal': sessionProposal, }, - options: PublishOptions( + options: const PublishOptions( correlationId: correlationId, publishMethod: RelayClient.WC_PROPOSE_SESSION, ), @@ -930,7 +930,7 @@ void main() { 'pairingTopic': pairingTopic, 'sessionProposal': sessionProposal, }, - options: PublishOptions( + options: const PublishOptions( correlationId: correlationId, publishMethod: RelayClient.WC_PROPOSE_SESSION, ), @@ -959,7 +959,7 @@ void main() { 'sessionProposalResponse': sessionProposalResponse, 'sessionSettlementRequest': sessionSettlementRequest, }, - options: PublishOptions( + options: const PublishOptions( correlationId: correlationId, publishMethod: RelayClient.WC_APPROVE_SESSION, ), @@ -987,7 +987,7 @@ void main() { 'sessionProposalResponse': sessionProposalResponse, 'sessionSettlementRequest': sessionSettlementRequest, }, - options: PublishOptions( + options: const PublishOptions( correlationId: correlationId, publishMethod: RelayClient.WC_APPROVE_SESSION, ), @@ -1015,7 +1015,7 @@ void main() { 'sessionProposalResponse': sessionProposalResponse, 'sessionSettlementRequest': sessionSettlementRequest, }, - options: PublishOptions( + options: const PublishOptions( correlationId: correlationId, publishMethod: RelayClient.WC_APPROVE_SESSION, ), @@ -1058,7 +1058,7 @@ void main() { 'pairingTopic': response.topic, 'sessionProposal': 'testSessionProposal', }, - options: PublishOptions( + options: const PublishOptions( publishMethod: RelayClient.WC_PROPOSE_SESSION, ), ); @@ -1103,7 +1103,7 @@ void main() { 'sessionProposalResponse': 'testSessionProposalResponse', 'sessionSettlementRequest': 'testSessionSettlementRequest', }, - options: PublishOptions( + options: const PublishOptions( publishMethod: RelayClient.WC_APPROVE_SESSION, ), ); diff --git a/packages/reown_core/test/verify/jwt_validation_test.dart b/packages/reown_core/test/verify/jwt_validation_test.dart index 55b7245f..08bce492 100644 --- a/packages/reown_core/test/verify/jwt_validation_test.dart +++ b/packages/reown_core/test/verify/jwt_validation_test.dart @@ -13,7 +13,7 @@ void main() { 'eyJleHAiOjE3MjI1Nzk5MDgsImlkIjoiNTEwNmEyNTU1MmU4OWFjZmI1YmVkODNlZTIxYmY0ZTgwZGJjZDUxYjBiMjAzZjY5MjVhMzY5YWFjYjFjODYwYiIsIm9yaWdpbiI6Imh0dHBzOi8vcmVhY3QtZGFwcC12Mi1naXQtY2hvcmUtdmVyaWZ5LXYyLXNhbXBsZXMtd2FsbGV0Y29ubmVjdDEudmVyY2VsLmFwcCIsImlzU2NhbSI6bnVsbCwiaXNWZXJpZmllZCI6dHJ1ZX0.' 'vm1TUofxpKc6yLYXDgR_p7AYhTC9_WMu9FOgY7l3fMAX_COgqIBGaY9NE8Sq8WmDGjTJroF15qsy9xD8dUXIcw'; - final jwk = JWK( + final jwk = const JWK( publicKey: PublicKey( crv: 'P-256', ext: true, diff --git a/packages/reown_core/test/verify/verify_test.dart b/packages/reown_core/test/verify/verify_test.dart index cc1c0924..482d1cef 100644 --- a/packages/reown_core/test/verify/verify_test.dart +++ b/packages/reown_core/test/verify/verify_test.dart @@ -57,7 +57,7 @@ void main() { }, 'expiresAt': DateTime.now() - .add(Duration(hours: 1)) + .add(const Duration(hours: 1)) .millisecondsSinceEpoch ~/ 1000, }), @@ -81,7 +81,7 @@ void main() { test('should handle expired public key', () async { // Arrange final expiredKey = JWK( - publicKey: PublicKey( + publicKey: const PublicKey( crv: 'P-256', ext: true, keyOps: ['verify'], @@ -91,7 +91,7 @@ void main() { ), expiresAt: DateTime.now() - .subtract(Duration(hours: 1)) + .subtract(const Duration(hours: 1)) .millisecondsSinceEpoch ~/ 1000, ); @@ -112,7 +112,7 @@ void main() { }, 'expiresAt': DateTime.now() - .add(Duration(hours: 1)) + .add(const Duration(hours: 1)) .millisecondsSinceEpoch ~/ 1000, }), @@ -141,7 +141,7 @@ void main() { when(mockVerifyStore.getItem()).thenReturn( JWK( - publicKey: PublicKey( + publicKey: const PublicKey( crv: 'P-256', ext: true, keyOps: ['verify'], @@ -150,7 +150,9 @@ void main() { y: 'KTFwjHtQxGTDR91VsOypcdBfvbo6sAMj5p4Wb-9hRA0', ), expiresAt: - DateTime.now().add(Duration(hours: 1)).millisecondsSinceEpoch ~/ + DateTime.now() + .add(const Duration(hours: 1)) + .millisecondsSinceEpoch ~/ 1000, ), ); @@ -182,7 +184,7 @@ void main() { // Arrange const attestationId = 'test-id'; const attestationJWT = null; - final expectedResponse = AttestationResponse( + final expectedResponse = const AttestationResponse( origin: 'https://example.com', attestationId: attestationId, isScam: false, @@ -248,7 +250,7 @@ void main() { group('getValidation', () { test('should return SCAM when attestation is scam', () { // Arrange - final attestation = AttestationResponse( + final attestation = const AttestationResponse( origin: 'https://example.com', attestationId: 'test-id', isScam: true, @@ -264,7 +266,7 @@ void main() { test('should return INVALID when origin is empty', () { // Arrange - final attestation = AttestationResponse( + final attestation = const AttestationResponse( origin: '', attestationId: 'test-id', isScam: false, @@ -280,7 +282,7 @@ void main() { test('should return INVALID when metadataUri is null', () { // Arrange - final attestation = AttestationResponse( + final attestation = const AttestationResponse( origin: 'https://example.com', attestationId: 'test-id', isScam: false, @@ -295,7 +297,7 @@ void main() { test('should return VALID when origins match', () { // Arrange - final attestation = AttestationResponse( + final attestation = const AttestationResponse( origin: 'https://example.com', attestationId: 'test-id', isScam: false, @@ -311,7 +313,7 @@ void main() { test('should return INVALID when origins do not match', () { // Arrange - final attestation = AttestationResponse( + final attestation = const AttestationResponse( origin: 'https://example.com', attestationId: 'test-id', isScam: false, @@ -331,7 +333,7 @@ void main() { test('should fetch and return public key successfully', () async { // Arrange final expectedJwk = JWK( - publicKey: PublicKey( + publicKey: const PublicKey( crv: 'P-256', ext: true, keyOps: ['verify'], @@ -340,7 +342,9 @@ void main() { y: 'KTFwjHtQxGTDR91VsOypcdBfvbo6sAMj5p4Wb-9hRA0', ), expiresAt: - DateTime.now().add(Duration(hours: 1)).millisecondsSinceEpoch ~/ + DateTime.now() + .add(const Duration(hours: 1)) + .millisecondsSinceEpoch ~/ 1000, ); @@ -387,7 +391,7 @@ void main() { test('should persist public key successfully', () async { // Arrange final jwk = JWK( - publicKey: PublicKey( + publicKey: const PublicKey( crv: 'P-256', ext: true, keyOps: ['verify'], @@ -396,7 +400,9 @@ void main() { y: 'KTFwjHtQxGTDR91VsOypcdBfvbo6sAMj5p4Wb-9hRA0', ), expiresAt: - DateTime.now().add(Duration(hours: 1)).millisecondsSinceEpoch ~/ + DateTime.now() + .add(const Duration(hours: 1)) + .millisecondsSinceEpoch ~/ 1000, ); @@ -427,7 +433,7 @@ void main() { test('should return persisted public key', () { // Arrange final expectedJwk = JWK( - publicKey: PublicKey( + publicKey: const PublicKey( crv: 'P-256', ext: true, keyOps: ['verify'], @@ -436,7 +442,9 @@ void main() { y: 'KTFwjHtQxGTDR91VsOypcdBfvbo6sAMj5p4Wb-9hRA0', ), expiresAt: - DateTime.now().add(Duration(hours: 1)).millisecondsSinceEpoch ~/ + DateTime.now() + .add(const Duration(hours: 1)) + .millisecondsSinceEpoch ~/ 1000, ); @@ -467,7 +475,7 @@ void main() { test('should return cached public key when available', () async { // Arrange final cachedJwk = JWK( - publicKey: PublicKey( + publicKey: const PublicKey( crv: 'P-256', ext: true, keyOps: ['verify'], @@ -476,7 +484,9 @@ void main() { y: 'KTFwjHtQxGTDR91VsOypcdBfvbo6sAMj5p4Wb-9hRA0', ), expiresAt: - DateTime.now().add(Duration(hours: 1)).millisecondsSinceEpoch ~/ + DateTime.now() + .add(const Duration(hours: 1)) + .millisecondsSinceEpoch ~/ 1000, ); @@ -510,7 +520,7 @@ void main() { }, 'expiresAt': DateTime.now() - .add(Duration(hours: 1)) + .add(const Duration(hours: 1)) .millisecondsSinceEpoch ~/ 1000, }), diff --git a/packages/reown_sign/analysis_options.yaml b/packages/reown_sign/analysis_options.yaml index b677fc6a..ac988f21 100644 --- a/packages/reown_sign/analysis_options.yaml +++ b/packages/reown_sign/analysis_options.yaml @@ -29,6 +29,9 @@ linter: sort_pub_dependencies: true avoid_unnecessary_containers: true cancel_subscriptions: true + prefer_const_constructors: true + # prefer_const_literals_to_create_immutables: true + avoid_field_initializers_in_const_classes: true analyzer: exclude: diff --git a/packages/reown_sign/lib/sign_engine.dart b/packages/reown_sign/lib/sign_engine.dart index f37f1fd8..c807e16a 100644 --- a/packages/reown_sign/lib/sign_engine.dart +++ b/packages/reown_sign/lib/sign_engine.dart @@ -1917,7 +1917,7 @@ class ReownSign implements IReownSign { final walletAddress = AddressUtils.getDidAddressAddress(iss)!; if (cacaoPayload.aud.isEmpty) { - throw ReownSignError(code: -1, message: 'aud is required'); + throw const ReownSignError(code: -1, message: 'aud is required'); } String? statement = cacaoPayload.statement; @@ -2679,10 +2679,10 @@ class ReownSign implements IReownSign { core.logger.d('[$runtimeType] dispatchEnvelope $url'); if (envelope.isEmpty) { - throw ReownSignError(code: 0, message: 'Envelope not found'); + throw const ReownSignError(code: 0, message: 'Envelope not found'); } if (topic.isEmpty) { - throw ReownSignError(code: 0, message: 'Topic not found'); + throw const ReownSignError(code: 0, message: 'Topic not found'); } final session = sessions.get(topic); diff --git a/packages/reown_sign/lib/utils/auth_signature.dart b/packages/reown_sign/lib/utils/auth_signature.dart index c2166331..6d1c4fec 100644 --- a/packages/reown_sign/lib/utils/auth_signature.dart +++ b/packages/reown_sign/lib/utils/auth_signature.dart @@ -216,7 +216,7 @@ class AuthSignature { .where((value) => requested.contains(value)) .toList(); if (approvedChains.isEmpty) { - throw ReownSignError(code: -1, message: 'No supported chains'); + throw const ReownSignError(code: -1, message: 'No supported chains'); } final requestedRecaps = ReCapsUtils.getDecodedRecapFromResources( diff --git a/packages/reown_sign/pubspec.yaml b/packages/reown_sign/pubspec.yaml index 06952be9..22f4ef5b 100644 --- a/packages/reown_sign/pubspec.yaml +++ b/packages/reown_sign/pubspec.yaml @@ -16,7 +16,8 @@ dependencies: freezed_annotation: ^3.1.0 http: ^1.2.2 pointycastle: ^4.0.0 - reown_core: ^1.3.8 + reown_core: + path: ../reown_core/ wallet: ^0.0.18 web3dart: ^3.0.1 diff --git a/packages/reown_sign/test/tests/sign_approve_session_authenticate.dart b/packages/reown_sign/test/tests/sign_approve_session_authenticate.dart index a9b49032..de16a49c 100644 --- a/packages/reown_sign/test/tests/sign_approve_session_authenticate.dart +++ b/packages/reown_sign/test/tests/sign_approve_session_authenticate.dart @@ -21,7 +21,7 @@ void signApproveSessionAuthenticate({ setUp(() async { clientA = await clientACreator( PROPOSER.copyWith( - redirect: Redirect( + redirect: const Redirect( native: 'clientA://', universal: 'https://lab.web3modal.com/dapp', linkMode: true, @@ -30,7 +30,7 @@ void signApproveSessionAuthenticate({ ); clientB = await clientBCreator( RESPONDER.copyWith( - redirect: Redirect( + redirect: const Redirect( native: 'clientB://', universal: 'https://lab.web3modal.com/wallet', linkMode: true, @@ -56,7 +56,7 @@ void signApproveSessionAuthenticate({ ), authPayload: CacaoRequestPayload.fromCacaoPayload(testCacaoPayload), expiryTimestamp: 1000000000000, - verifyContext: VerifyContext( + verifyContext: const VerifyContext( origin: 'test.com', validation: Validation.VALID, verifyUrl: ReownConstants.VERIFY_SERVER, diff --git a/packages/reown_sign/test/tests/sign_authenticate.dart b/packages/reown_sign/test/tests/sign_authenticate.dart index 6983f456..45717ff9 100644 --- a/packages/reown_sign/test/tests/sign_authenticate.dart +++ b/packages/reown_sign/test/tests/sign_authenticate.dart @@ -21,7 +21,7 @@ void signAuthenticate({ setUp(() async { clientA = await clientACreator( PROPOSER.copyWith( - redirect: Redirect( + redirect: const Redirect( native: 'clientA://', universal: 'https://lab.web3modal.com/dapp', linkMode: true, @@ -30,7 +30,7 @@ void signAuthenticate({ ); clientB = await clientBCreator( RESPONDER.copyWith( - redirect: Redirect( + redirect: const Redirect( native: 'clientB://', universal: 'https://lab.web3modal.com/wallet', linkMode: true, @@ -61,7 +61,7 @@ void signAuthenticate({ ); SessionAuthRequestResponse response = await clientA.authenticate( - params: SessionAuthRequestParams( + params: const SessionAuthRequestParams( chains: ['eip155:1'], domain: 'lab.web3modal.com', nonce: 'XpJ0thNvq9lNixmwN', diff --git a/packages/reown_sign/test/tvf_collection_test.dart b/packages/reown_sign/test/tvf_collection_test.dart index bce3eb1d..f89c6f7a 100644 --- a/packages/reown_sign/test/tvf_collection_test.dart +++ b/packages/reown_sign/test/tvf_collection_test.dart @@ -74,7 +74,7 @@ void main() { test('should collect request TVF data when calling request()', () async { // Arrange final id = 123; - final request = SessionRequestParams( + final request = const SessionRequestParams( method: 'eth_sendTransaction', params: [ { @@ -94,17 +94,17 @@ void main() { acknowledged: true, controller: 'test_controller', namespaces: { - 'eip155': Namespace( + 'eip155': const Namespace( accounts: ['eip155:1:0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6'], methods: ['eth_sendTransaction'], events: ['chainChanged'], ), }, - self: ConnectionMetadata( + self: const ConnectionMetadata( publicKey: 'test_self_key', metadata: RESPONDER, ), - peer: ConnectionMetadata( + peer: const ConnectionMetadata( publicKey: 'test_peer_key', metadata: PROPOSER, ), @@ -138,7 +138,7 @@ void main() { test('should handle invalid contract data gracefully', () async { // Arrange final id = 126; - final request = SessionRequestParams( + final request = const SessionRequestParams( method: 'eth_sendTransaction', params: [ { @@ -158,17 +158,17 @@ void main() { acknowledged: true, controller: 'test_controller_4', namespaces: { - 'eip155': Namespace( + 'eip155': const Namespace( accounts: ['eip155:1:0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6'], methods: ['eth_sendTransaction'], events: ['chainChanged'], ), }, - self: ConnectionMetadata( + self: const ConnectionMetadata( publicKey: 'test_self_key_4', metadata: RESPONDER, ), - peer: ConnectionMetadata( + peer: const ConnectionMetadata( publicKey: 'test_peer_key_4', metadata: PROPOSER, ), @@ -200,7 +200,7 @@ void main() { () async { // Arrange final id = 127; - final request = SessionRequestParams( + final request = const SessionRequestParams( method: 'eth_sendTransaction', params: [ { @@ -220,7 +220,7 @@ void main() { acknowledged: true, controller: 'test_controller_5', namespaces: { - 'eip155': Namespace( + 'eip155': const Namespace( accounts: [ 'eip155:1:0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6', ], @@ -228,11 +228,11 @@ void main() { events: ['chainChanged'], ), }, - self: ConnectionMetadata( + self: const ConnectionMetadata( publicKey: 'test_self_key_5', metadata: RESPONDER, ), - peer: ConnectionMetadata( + peer: const ConnectionMetadata( publicKey: 'test_peer_key_5', metadata: PROPOSER, ), @@ -262,7 +262,7 @@ void main() { method: 'eth_sendTransaction', chainId: 'eip155:1', params: request.params, - verifyContext: VerifyContext( + verifyContext: const VerifyContext( origin: 'test_origin', verifyUrl: 'test_verify_url', validation: Validation.VALID, @@ -294,7 +294,7 @@ void main() { test('should handle response with error gracefully', () async { // Arrange final id = 128; - final request = SessionRequestParams( + final request = const SessionRequestParams( method: 'eth_sendTransaction', params: [ { @@ -314,17 +314,17 @@ void main() { acknowledged: true, controller: 'test_controller_6', namespaces: { - 'eip155': Namespace( + 'eip155': const Namespace( accounts: ['eip155:1:0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6'], methods: ['eth_sendTransaction'], events: ['chainChanged'], ), }, - self: ConnectionMetadata( + self: const ConnectionMetadata( publicKey: 'test_self_key_6', metadata: RESPONDER, ), - peer: ConnectionMetadata( + peer: const ConnectionMetadata( publicKey: 'test_peer_key_6', metadata: PROPOSER, ), @@ -354,7 +354,7 @@ void main() { method: 'eth_sendTransaction', chainId: 'eip155:1', params: request.params, - verifyContext: VerifyContext( + verifyContext: const VerifyContext( origin: 'test_origin', verifyUrl: 'test_verify_url', validation: Validation.VALID, @@ -365,7 +365,7 @@ void main() { // Create response with error final response = JsonRpcResponse( id: id, - error: JsonRpcError(code: -32603, message: 'Internal error'), + error: const JsonRpcError(code: -32603, message: 'Internal error'), ); // Act @@ -387,7 +387,7 @@ void main() { () async { // Arrange final id = 129; - final request = SessionRequestParams( + final request = const SessionRequestParams( method: 'wallet_sendCalls', params: [ { @@ -407,7 +407,7 @@ void main() { acknowledged: true, controller: 'test_controller_7', namespaces: { - 'eip155': Namespace( + 'eip155': const Namespace( accounts: [ 'eip155:1:0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6', ], @@ -415,11 +415,11 @@ void main() { events: ['chainChanged'], ), }, - self: ConnectionMetadata( + self: const ConnectionMetadata( publicKey: 'test_self_key_7', metadata: RESPONDER, ), - peer: ConnectionMetadata( + peer: const ConnectionMetadata( publicKey: 'test_peer_key_7', metadata: PROPOSER, ), @@ -449,7 +449,7 @@ void main() { method: 'wallet_sendCalls', chainId: 'eip155:1', params: request.params, - verifyContext: VerifyContext( + verifyContext: const VerifyContext( origin: 'test_origin', verifyUrl: 'test_verify_url', validation: Validation.VALID, @@ -499,7 +499,7 @@ void main() { test('should collect simple EVM transaction hash correctly', () async { // Arrange final id = 130; - final request = SessionRequestParams( + final request = const SessionRequestParams( method: 'eth_sendTransaction', params: [ { @@ -519,17 +519,17 @@ void main() { acknowledged: true, controller: 'test_controller_8', namespaces: { - 'eip155': Namespace( + 'eip155': const Namespace( accounts: ['eip155:1:0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6'], methods: ['eth_sendTransaction'], events: ['chainChanged'], ), }, - self: ConnectionMetadata( + self: const ConnectionMetadata( publicKey: 'test_self_key_8', metadata: RESPONDER, ), - peer: ConnectionMetadata( + peer: const ConnectionMetadata( publicKey: 'test_peer_key_8', metadata: PROPOSER, ), @@ -559,7 +559,7 @@ void main() { method: 'eth_sendTransaction', chainId: 'eip155:1', params: request.params, - verifyContext: VerifyContext( + verifyContext: const VerifyContext( origin: 'test_origin', verifyUrl: 'test_verify_url', validation: Validation.VALID, @@ -589,7 +589,7 @@ void main() { () async { // Arrange final id = 131; - final request = SessionRequestParams( + final request = const SessionRequestParams( method: 'ton_sendTransaction', params: [ { @@ -609,7 +609,7 @@ void main() { acknowledged: true, controller: 'test_controller_9', namespaces: { - 'ton': Namespace( + 'ton': const Namespace( accounts: [ 'ton:mainnet:EQD0vdSA_NedR9uv6d8Q8N8ukdWVtJ3Fylj80P4g5zg-Lh0', ], @@ -617,11 +617,11 @@ void main() { events: ['chainChanged'], ), }, - self: ConnectionMetadata( + self: const ConnectionMetadata( publicKey: 'test_self_key_9', metadata: RESPONDER, ), - peer: ConnectionMetadata( + peer: const ConnectionMetadata( publicKey: 'test_peer_key_9', metadata: PROPOSER, ), @@ -651,7 +651,7 @@ void main() { method: 'ton_sendTransaction', chainId: 'ton:mainnet', params: request.params, - verifyContext: VerifyContext( + verifyContext: const VerifyContext( origin: 'test_origin', verifyUrl: 'test_verify_url', validation: Validation.VALID, @@ -691,7 +691,7 @@ void main() { test('should collect basic request TVF data', () { // Arrange final id = 200; - final request = WcSessionRequestRequest( + final request = const WcSessionRequestRequest( chainId: 'eip155:1', request: SessionRequestParams( method: 'eth_sendTransaction', @@ -724,7 +724,7 @@ void main() { test('should collect contract address for EVM contract calls', () { // Arrange final id = 201; - final request = WcSessionRequestRequest( + final request = const WcSessionRequestRequest( chainId: 'eip155:1', request: SessionRequestParams( method: 'eth_sendTransaction', @@ -754,7 +754,7 @@ void main() { test('should handle different RPC methods', () { // Arrange final id = 202; - final request = WcSessionRequestRequest( + final request = const WcSessionRequestRequest( chainId: 'eip155:1', request: SessionRequestParams( method: 'personal_sign', @@ -779,7 +779,7 @@ void main() { test('should handle non-EVM chains', () { // Arrange final id = 203; - final request = WcSessionRequestRequest( + final request = const WcSessionRequestRequest( chainId: 'solana:mainnet', request: SessionRequestParams( method: 'solana_signTransaction', @@ -803,7 +803,7 @@ void main() { test('should handle TON chains', () { // Arrange final id = 204; - final request = WcSessionRequestRequest( + final request = const WcSessionRequestRequest( chainId: 'ton:mainnet', request: SessionRequestParams( method: 'ton_sendTransaction', @@ -833,7 +833,7 @@ void main() { test('should collect response TVF data and remove from pending', () { // Arrange final id = 300; - final request = WcSessionRequestRequest( + final request = const WcSessionRequestRequest( chainId: 'eip155:1', request: SessionRequestParams( method: 'eth_sendTransaction', @@ -874,7 +874,7 @@ void main() { test('should collect TON response TVF data correctly', () { // Arrange final id = 302; - final request = WcSessionRequestRequest( + final request = const WcSessionRequestRequest( chainId: 'ton:mainnet', request: SessionRequestParams( method: 'ton_sendTransaction', @@ -923,7 +923,10 @@ void main() { test('should return null for non-existent request ID', () { // Arrange - final response = JsonRpcResponse(id: 999, result: '0x1234567890abcdef'); + final response = const JsonRpcResponse( + id: 999, + result: '0x1234567890abcdef', + ); // Act final tvfData = signEngine.collectResponseTVF(response); @@ -935,7 +938,7 @@ void main() { test('should handle response with error', () { // Arrange final id = 301; - final request = WcSessionRequestRequest( + final request = const WcSessionRequestRequest( chainId: 'eip155:1', request: SessionRequestParams( method: 'eth_sendTransaction', @@ -955,7 +958,7 @@ void main() { // Create response with error final response = JsonRpcResponse( id: id, - error: JsonRpcError(code: -32603, message: 'Internal error'), + error: const JsonRpcError(code: -32603, message: 'Internal error'), ); // Act @@ -971,7 +974,7 @@ void main() { group('Direct Method Testing - collectHashes', () { test('should collect EVM wallet_sendCalls 2.0.0 hashes correctly', () { // Arrange - final response = JsonRpcResponse( + final response = const JsonRpcResponse( id: 400, result: { 'id': '0x1234567890abcdef', @@ -1006,7 +1009,10 @@ void main() { test('should collect simple EVM transaction hash', () { // Arrange - final response = JsonRpcResponse(id: 401, result: '0x1234567890abcdef'); + final response = const JsonRpcResponse( + id: 401, + result: '0x1234567890abcdef', + ); // Act final hashes = signEngine.collectHashes('eip155', response); @@ -1019,7 +1025,7 @@ void main() { test('should return null for EVM response with error', () { // Arrange - final response = JsonRpcResponse( + final response = const JsonRpcResponse( id: 402, error: JsonRpcError(code: -32603, message: 'Internal error'), ); @@ -1033,7 +1039,7 @@ void main() { test('should return null for EVM response with null result', () { // Arrange - final response = JsonRpcResponse(id: 403, result: null); + final response = const JsonRpcResponse(id: 403, result: null); // Act final hashes = signEngine.collectHashes('eip155', response); @@ -1044,7 +1050,7 @@ void main() { test('should collect TON transaction hash correctly', () { // Arrange - final response = JsonRpcResponse( + final response = const JsonRpcResponse( id: 404, result: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef', @@ -1066,7 +1072,7 @@ void main() { test('should return null for TON response with error', () { // Arrange - final response = JsonRpcResponse( + final response = const JsonRpcResponse( id: 405, error: JsonRpcError(code: -32603, message: 'Internal error'), ); @@ -1080,7 +1086,7 @@ void main() { test('should return null for TON response with null result', () { // Arrange - final response = JsonRpcResponse(id: 406, result: null); + final response = const JsonRpcResponse(id: 406, result: null); // Act final hashes = signEngine.collectHashes('ton', response); @@ -1091,7 +1097,7 @@ void main() { test('should return null for TON response with non-string result', () { // Arrange - final response = JsonRpcResponse( + final response = const JsonRpcResponse( id: 407, result: {'hash': '0x1234567890abcdef'}, ); diff --git a/packages/reown_walletkit/analysis_options.yaml b/packages/reown_walletkit/analysis_options.yaml index b677fc6a..ac988f21 100644 --- a/packages/reown_walletkit/analysis_options.yaml +++ b/packages/reown_walletkit/analysis_options.yaml @@ -29,6 +29,9 @@ linter: sort_pub_dependencies: true avoid_unnecessary_containers: true cancel_subscriptions: true + prefer_const_constructors: true + # prefer_const_literals_to_create_immutables: true + avoid_field_initializers_in_const_classes: true analyzer: exclude: diff --git a/packages/reown_walletkit/example/analysis_options.yaml b/packages/reown_walletkit/example/analysis_options.yaml index b677fc6a..ac988f21 100644 --- a/packages/reown_walletkit/example/analysis_options.yaml +++ b/packages/reown_walletkit/example/analysis_options.yaml @@ -29,6 +29,9 @@ linter: sort_pub_dependencies: true avoid_unnecessary_containers: true cancel_subscriptions: true + prefer_const_constructors: true + # prefer_const_literals_to_create_immutables: true + avoid_field_initializers_in_const_classes: true analyzer: exclude: diff --git a/packages/reown_walletkit/example/ios/Podfile.lock b/packages/reown_walletkit/example/ios/Podfile.lock index d7785c72..17281303 100644 --- a/packages/reown_walletkit/example/ios/Podfile.lock +++ b/packages/reown_walletkit/example/ios/Podfile.lock @@ -3,8 +3,6 @@ PODS: - flutter_secure_storage (6.0.0): - Flutter - MTBBarcodeScanner (5.0.11) - - objective_c (0.0.1): - - Flutter - qr_bar_code_scanner_dialog (0.0.1): - Flutter - qr_code_scanner (0.2.0): @@ -15,14 +13,13 @@ PODS: - YttriumUtilsWrapper (= 0.9.110) - walletconnect_pay (0.0.1): - Flutter - - YttriumWrapper (= 0.10.15) + - YttriumWrapper (= 0.10.20) - YttriumUtilsWrapper (0.9.110) - - YttriumWrapper (0.10.15) + - YttriumWrapper (0.10.20) DEPENDENCIES: - Flutter (from `Flutter`) - flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`) - - objective_c (from `.symlinks/plugins/objective_c/ios`) - qr_bar_code_scanner_dialog (from `.symlinks/plugins/qr_bar_code_scanner_dialog/ios`) - qr_code_scanner (from `.symlinks/plugins/qr_code_scanner/ios`) - reown_yttrium_utils (from `.symlinks/plugins/reown_yttrium_utils/ios`) @@ -39,8 +36,6 @@ EXTERNAL SOURCES: :path: Flutter flutter_secure_storage: :path: ".symlinks/plugins/flutter_secure_storage/ios" - objective_c: - :path: ".symlinks/plugins/objective_c/ios" qr_bar_code_scanner_dialog: :path: ".symlinks/plugins/qr_bar_code_scanner_dialog/ios" qr_code_scanner: @@ -54,13 +49,12 @@ SPEC CHECKSUMS: Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467 flutter_secure_storage: 1ed9476fba7e7a782b22888f956cce43e2c62f13 MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb - objective_c: 89e720c30d716b036faf9c9684022048eee1eee2 qr_bar_code_scanner_dialog: a4cb7ad7201cbf8b888f3e6e58972b611ac43b28 qr_code_scanner: d77f94ecc9abf96d9b9b8fc04ef13f611e5a147a reown_yttrium_utils: b72dcd07e1b012cbe7ca4e8f23ed554108b28c91 - walletconnect_pay: 95df6f3533532d72e2ce2a64354f4326177c6fc1 + walletconnect_pay: 16113827fdf58df4467fa640c971d3b67701992b YttriumUtilsWrapper: d5704a305f87956ec06040d1687eef3943459438 - YttriumWrapper: cbddb60c835ebc4232d9f57064084ab30686a18e + YttriumWrapper: be3104ba2155f2ca3baa43542bddbf615acae36a PODFILE CHECKSUM: 0772a2bd8cd4c7aaeb2576ddfaf6b03be722593b diff --git a/packages/reown_walletkit/example/ios/Runner.xcodeproj/project.pbxproj b/packages/reown_walletkit/example/ios/Runner.xcodeproj/project.pbxproj index 7867d4ad..82fe6ac2 100644 --- a/packages/reown_walletkit/example/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/reown_walletkit/example/ios/Runner.xcodeproj/project.pbxproj @@ -9,13 +9,13 @@ /* Begin PBXBuildFile section */ 091D8F542C4A7A5000904D6C /* Info-internal.plist in Resources */ = {isa = PBXBuildFile; fileRef = 091D8F532C4A7A5000904D6C /* Info-internal.plist */; }; 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 17E0C348CB800520CAB0DF07 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DAA7D70BD93D947BFFADA9D7 /* Pods_Runner.framework */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; - C6BFF497A6D0FA4AF9ACC766 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 40FD8EEE8F48D1F0D6AFEBD2 /* Pods_Runner.framework */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -34,19 +34,18 @@ /* Begin PBXFileReference section */ 091D8F532C4A7A5000904D6C /* Info-internal.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Info-internal.plist"; sourceTree = ""; }; 0978D7E02C6B682E00E3593C /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = ""; }; + 0DE8E3471D9877D22ECDA68E /* Pods-Runner.profile-production.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile-production.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile-production.xcconfig"; sourceTree = ""; }; + 0F6423C5047646DD2E1AAB4C /* Pods-Runner.debug-production.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug-production.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug-production.xcconfig"; sourceTree = ""; }; 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; - 1790F65ED793A7C20AB48D74 /* Pods-Runner.debug-internal.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug-internal.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug-internal.xcconfig"; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; - 40FD8EEE8F48D1F0D6AFEBD2 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 534C9A5FBAFC21173A689E65 /* Pods-Runner.profile-internal.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile-internal.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile-internal.xcconfig"; sourceTree = ""; }; - 5D053039C543BA78C20F99D0 /* Pods-Runner.release-internal.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release-internal.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release-internal.xcconfig"; sourceTree = ""; }; + 4F0D7331C0C47B03EFC2B939 /* Pods-Runner.release-internal.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release-internal.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release-internal.xcconfig"; sourceTree = ""; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 78E0A7A72DC9AD7400C4905E /* FlutterGeneratedPluginSwiftPackage */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = FlutterGeneratedPluginSwiftPackage; path = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; sourceTree = ""; }; + 799F78A9EDE5F2C720ABED01 /* Pods-Runner.profile-internal.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile-internal.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile-internal.xcconfig"; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; - 7E57269F4507EE645707C26F /* Pods-Runner.profile-production.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile-production.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile-production.xcconfig"; sourceTree = ""; }; - 8C68DFA67D71EE626E5F00CA /* Pods-Runner.debug-production.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug-production.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug-production.xcconfig"; sourceTree = ""; }; + 950AFCAD432162C73C7444D6 /* Pods-Runner.release-production.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release-production.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release-production.xcconfig"; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -54,7 +53,8 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - E5A8842F501E45734B289E82 /* Pods-Runner.release-production.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release-production.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release-production.xcconfig"; sourceTree = ""; }; + C6139654C607DE8E3C48347C /* Pods-Runner.debug-internal.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug-internal.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug-internal.xcconfig"; sourceTree = ""; }; + DAA7D70BD93D947BFFADA9D7 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -63,13 +63,21 @@ buildActionMask = 2147483647; files = ( 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */, - C6BFF497A6D0FA4AF9ACC766 /* Pods_Runner.framework in Frameworks */, + 17E0C348CB800520CAB0DF07 /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 69CA998E32ACACE0335BE5ED /* Frameworks */ = { + isa = PBXGroup; + children = ( + DAA7D70BD93D947BFFADA9D7 /* Pods_Runner.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( @@ -89,7 +97,7 @@ 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, C4281BF2C021B5570082F0DC /* Pods */, - DCA0845A8FA9EEE9AE7D263F /* Frameworks */, + 69CA998E32ACACE0335BE5ED /* Frameworks */, ); sourceTree = ""; }; @@ -121,24 +129,16 @@ C4281BF2C021B5570082F0DC /* Pods */ = { isa = PBXGroup; children = ( - 8C68DFA67D71EE626E5F00CA /* Pods-Runner.debug-production.xcconfig */, - 1790F65ED793A7C20AB48D74 /* Pods-Runner.debug-internal.xcconfig */, - E5A8842F501E45734B289E82 /* Pods-Runner.release-production.xcconfig */, - 5D053039C543BA78C20F99D0 /* Pods-Runner.release-internal.xcconfig */, - 7E57269F4507EE645707C26F /* Pods-Runner.profile-production.xcconfig */, - 534C9A5FBAFC21173A689E65 /* Pods-Runner.profile-internal.xcconfig */, + 0F6423C5047646DD2E1AAB4C /* Pods-Runner.debug-production.xcconfig */, + C6139654C607DE8E3C48347C /* Pods-Runner.debug-internal.xcconfig */, + 950AFCAD432162C73C7444D6 /* Pods-Runner.release-production.xcconfig */, + 4F0D7331C0C47B03EFC2B939 /* Pods-Runner.release-internal.xcconfig */, + 0DE8E3471D9877D22ECDA68E /* Pods-Runner.profile-production.xcconfig */, + 799F78A9EDE5F2C720ABED01 /* Pods-Runner.profile-internal.xcconfig */, ); path = Pods; sourceTree = ""; }; - DCA0845A8FA9EEE9AE7D263F /* Frameworks */ = { - isa = PBXGroup; - children = ( - 40FD8EEE8F48D1F0D6AFEBD2 /* Pods_Runner.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -146,14 +146,14 @@ isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( - 1582161933B3A59D8DBD752C /* [CP] Check Pods Manifest.lock */, + C27773E0DC8A2902B4A0EA01 /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, - BFAC20FA082285F9E5ED3F47 /* [CP] Embed Pods Frameworks */, + FCB319E09B6E4287DA5F2C54 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -219,60 +219,60 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 1582161933B3A59D8DBD752C /* [CP] Check Pods Manifest.lock */ = { + 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); - inputFileListPaths = ( - ); inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( + "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", ); + name = "Thin Binary"; outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; }; - 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { + 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); inputPaths = ( - "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", ); - name = "Thin Binary"; + name = "Run Script"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; - 9740EEB61CF901F6004384FC /* Run Script */ = { + C27773E0DC8A2902B4A0EA01 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; - alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); + inputFileListPaths = ( + ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( ); - name = "Run Script"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; }; - BFAC20FA082285F9E5ED3F47 /* [CP] Embed Pods Frameworks */ = { + FCB319E09B6E4287DA5F2C54 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( diff --git a/packages/reown_walletkit/example/lib/dependencies/bottom_sheet/bottom_sheet_listener.dart b/packages/reown_walletkit/example/lib/dependencies/bottom_sheet/bottom_sheet_listener.dart index 88482da9..cce18e84 100644 --- a/packages/reown_walletkit/example/lib/dependencies/bottom_sheet/bottom_sheet_listener.dart +++ b/packages/reown_walletkit/example/lib/dependencies/bottom_sheet/bottom_sheet_listener.dart @@ -56,7 +56,7 @@ class BottomSheetListenerState extends State { // final isDark = // MediaQuery.of(context).platformBrightness == Brightness.dark; return Material( - borderRadius: BorderRadius.only( + borderRadius: const BorderRadius.only( topLeft: Radius.circular(StyleConstants.linear32), topRight: Radius.circular(StyleConstants.linear32), ), diff --git a/packages/reown_walletkit/example/lib/dependencies/chain_services/cosmos_service.dart b/packages/reown_walletkit/example/lib/dependencies/chain_services/cosmos_service.dart index 1bd96cc3..b228dac7 100644 --- a/packages/reown_walletkit/example/lib/dependencies/chain_services/cosmos_service.dart +++ b/packages/reown_walletkit/example/lib/dependencies/chain_services/cosmos_service.dart @@ -309,8 +309,7 @@ class CosmosService { // Try to fetch from chain registry API final chainName = _getChainName(); if (chainName != null) { - final url = - 'https://chains.cosmos.directory/$chainName/assetlist'; + final url = 'https://chains.cosmos.directory/$chainName/assetlist'; final response = await http.get(Uri.parse(url)); if (response.statusCode == 200) { diff --git a/packages/reown_walletkit/example/lib/dependencies/chain_services/kadena_service.dart b/packages/reown_walletkit/example/lib/dependencies/chain_services/kadena_service.dart index 2c8fd0c3..4d3d21e2 100644 --- a/packages/reown_walletkit/example/lib/dependencies/chain_services/kadena_service.dart +++ b/packages/reown_walletkit/example/lib/dependencies/chain_services/kadena_service.dart @@ -449,11 +449,13 @@ class KadenaService { 'sigs': >[], }; - final response = await http.post( - Uri.parse(url), - headers: {'Content-Type': 'application/json'}, - body: jsonEncode(cmd), - ).timeout(const Duration(seconds: 10)); + final response = await http + .post( + Uri.parse(url), + headers: {'Content-Type': 'application/json'}, + body: jsonEncode(cmd), + ) + .timeout(const Duration(seconds: 10)); if (response.statusCode == 200) { final result = jsonDecode(response.body) as Map; diff --git a/packages/reown_walletkit/example/lib/dependencies/chain_services/polkadot_service.dart b/packages/reown_walletkit/example/lib/dependencies/chain_services/polkadot_service.dart index da99ba7d..8142fafe 100644 --- a/packages/reown_walletkit/example/lib/dependencies/chain_services/polkadot_service.dart +++ b/packages/reown_walletkit/example/lib/dependencies/chain_services/polkadot_service.dart @@ -272,7 +272,8 @@ class PolkadotService { ); if (response.statusCode != 200) { - debugPrint('[PolkadotService] Subscan API error: ${response.statusCode}'); + debugPrint( + '[PolkadotService] Subscan API error: ${response.statusCode}'); // Fallback to native balance only return _getNativeBalanceOnly(address); } diff --git a/packages/reown_walletkit/example/lib/dependencies/chain_services/solana_service.dart b/packages/reown_walletkit/example/lib/dependencies/chain_services/solana_service.dart index ca50c524..665aa7f6 100644 --- a/packages/reown_walletkit/example/lib/dependencies/chain_services/solana_service.dart +++ b/packages/reown_walletkit/example/lib/dependencies/chain_services/solana_service.dart @@ -552,7 +552,7 @@ extension on String { final secKeyBytes = base58.decode(this); return Uint8List.fromList(secKeyBytes.sublist(0, 32)); } catch (e) { - throw FormatException( + throw const FormatException( 'Unable to parse private key. Expected comma-separated integers, hex string, or base58 string.', ); } diff --git a/packages/reown_walletkit/example/lib/dependencies/chain_services/stacks/stacks_service.dart b/packages/reown_walletkit/example/lib/dependencies/chain_services/stacks/stacks_service.dart index 627ee189..60591492 100644 --- a/packages/reown_walletkit/example/lib/dependencies/chain_services/stacks/stacks_service.dart +++ b/packages/reown_walletkit/example/lib/dependencies/chain_services/stacks/stacks_service.dart @@ -253,7 +253,8 @@ class StacksService { if (stx != null) { final balance = stx['balance'] as String? ?? '0'; final rawAmount = BigInt.parse(balance); - final quantity = rawAmount / BigInt.from(10).pow(6); // STX has 6 decimals + final quantity = + rawAmount / BigInt.from(10).pow(6); // STX has 6 decimals tokens.add({ 'name': 'Stacks', @@ -285,7 +286,8 @@ class StacksService { // Try to get token price from CoinGecko if it's a known token final symbol = metadata['symbol'] ?? _extractTokenSymbol(tokenId); - final tokenPrice = await _getTokenPrice(symbol.toString().toLowerCase()); + final tokenPrice = + await _getTokenPrice(symbol.toString().toLowerCase()); tokens.add({ 'name': metadata['name'] ?? _extractTokenName(tokenId), diff --git a/packages/reown_walletkit/example/lib/dependencies/chain_services/ton/ton_service.dart b/packages/reown_walletkit/example/lib/dependencies/chain_services/ton/ton_service.dart index 393463fb..655c6e98 100644 --- a/packages/reown_walletkit/example/lib/dependencies/chain_services/ton/ton_service.dart +++ b/packages/reown_walletkit/example/lib/dependencies/chain_services/ton/ton_service.dart @@ -53,7 +53,7 @@ class TonService { Future generateKeypair() async { if (DartDefines.tonSK.isNotEmpty && DartDefines.tonPK.isNotEmpty) { - return TonKeyPair(sk: DartDefines.tonSK, pk: DartDefines.tonPK); + return const TonKeyPair(sk: DartDefines.tonSK, pk: DartDefines.tonPK); } return await _tonClient.generateKeypair(); } diff --git a/packages/reown_walletkit/example/lib/main.dart b/packages/reown_walletkit/example/lib/main.dart index 71924fb7..a716d38b 100644 --- a/packages/reown_walletkit/example/lib/main.dart +++ b/packages/reown_walletkit/example/lib/main.dart @@ -30,7 +30,7 @@ Future main() async { DeepLinkHandler.initListener(); if (kDebugMode) { - runApp(MyApp()); + runApp(const MyApp()); } else { // Catch Flutter framework errors FlutterError.onError = (FlutterErrorDetails details) { @@ -159,7 +159,7 @@ class _MyHomePageState extends State { return keyService; }); GetIt.I.registerSingleton(WalletKitService()); - await GetIt.I.allReady(timeout: Duration(seconds: 1)); + await GetIt.I.allReady(timeout: const Duration(seconds: 1)); final walletKitService = GetIt.I(); await walletKitService.create(); @@ -190,7 +190,7 @@ class _MyHomePageState extends State { void _setPages() => setState(() { _pageDatas = [ PageData( - page: BalancesPage(), + page: const BalancesPage(), title: 'Balances', icon: Icons.account_balance_wallet_outlined, ), diff --git a/packages/reown_walletkit/example/lib/models/chain_data.dart b/packages/reown_walletkit/example/lib/models/chain_data.dart index a5915639..d861d1f2 100644 --- a/packages/reown_walletkit/example/lib/models/chain_data.dart +++ b/packages/reown_walletkit/example/lib/models/chain_data.dart @@ -76,36 +76,36 @@ class ChainsDataList { color: Colors.black, rpc: ['https://rpc.walletconnect.org/v1'], ), - ChainMetadata( + const ChainMetadata( type: ChainType.eip155, chainId: 'eip155:11155111', name: 'Eth Sepolia', currency: 'ETH', logo: 'https://pbs.twimg.com/profile_images/1878738447067652096/tXQbWfpf_400x400.jpg', - color: const Color.fromARGB(255, 0, 0, 0), + color: Color.fromARGB(255, 0, 0, 0), isTestnet: true, rpc: ['https://rpc.walletconnect.org/v1'], ), - ChainMetadata( + const ChainMetadata( type: ChainType.eip155, chainId: 'eip155:84531', name: 'Base Sepolia', currency: 'ETH', logo: 'https://pbs.twimg.com/profile_images/1878738447067652096/tXQbWfpf_400x400.jpg', - color: const Color.fromARGB(255, 0, 0, 0), + color: Color.fromARGB(255, 0, 0, 0), isTestnet: true, rpc: ['https://sepolia.base.org'], ), - ChainMetadata( + const ChainMetadata( type: ChainType.eip155, chainId: 'eip155:80001', name: 'Polygon Mumbai', currency: 'MATIC', logo: 'https://pbs.twimg.com/profile_images/1878738447067652096/tXQbWfpf_400x400.jpg', - color: const Color.fromARGB(255, 0, 0, 0), + color: Color.fromARGB(255, 0, 0, 0), isTestnet: true, rpc: ['https://matic-mumbai.chainstacklabs.com'], ), diff --git a/packages/reown_walletkit/example/lib/pages/app_detail_page.dart b/packages/reown_walletkit/example/lib/pages/app_detail_page.dart index e3b48a6b..a7e64635 100644 --- a/packages/reown_walletkit/example/lib/pages/app_detail_page.dart +++ b/packages/reown_walletkit/example/lib/pages/app_detail_page.dart @@ -209,12 +209,12 @@ class AppDetailPageState extends State { width: 1.0, color: Colors.black38, ), - borderRadius: BorderRadius.all( + borderRadius: const BorderRadius.all( Radius.circular(40.0), ), ), child: ClipRRect( - borderRadius: BorderRadius.all( + borderRadius: const BorderRadius.all( Radius.circular(40.0), ), child: SvgPicture.network(imageUrl), @@ -226,7 +226,7 @@ class AppDetailPageState extends State { radius: 40.0, ); } - return CircleAvatar( + return const CircleAvatar( radius: 40.0, backgroundColor: Colors.black12, ); diff --git a/packages/reown_walletkit/example/lib/pages/apps_page.dart b/packages/reown_walletkit/example/lib/pages/apps_page.dart index 9c1c0e75..587de296 100644 --- a/packages/reown_walletkit/example/lib/pages/apps_page.dart +++ b/packages/reown_walletkit/example/lib/pages/apps_page.dart @@ -73,7 +73,7 @@ class AppsPageState extends State with WidgetsBindingObserver { toastification.show( title: Text(jsonObject.method, maxLines: 1), context: context, - autoCloseDuration: Duration(seconds: 2), + autoCloseDuration: const Duration(seconds: 2), alignment: Alignment.bottomCenter, ); } diff --git a/packages/reown_walletkit/example/lib/pages/balances_page.dart b/packages/reown_walletkit/example/lib/pages/balances_page.dart index 948b5c8c..e948b29a 100644 --- a/packages/reown_walletkit/example/lib/pages/balances_page.dart +++ b/packages/reown_walletkit/example/lib/pages/balances_page.dart @@ -439,7 +439,7 @@ class _BalancesPageState extends State { ), child: _isLoading ? FutureBuilder( - future: Future.delayed(Duration(milliseconds: 100)), + future: Future.delayed(const Duration(milliseconds: 100)), initialData: null, builder: (context, snapshot) { if (snapshot.hasData) { @@ -456,7 +456,7 @@ class _BalancesPageState extends State { ), ); } - return SizedBox.shrink(); + return const SizedBox.shrink(); }) : SingleChildScrollView( physics: const AlwaysScrollableScrollPhysics(), diff --git a/packages/reown_walletkit/example/lib/pages/settings_page.dart b/packages/reown_walletkit/example/lib/pages/settings_page.dart index c06bf6de..cfecd03b 100644 --- a/packages/reown_walletkit/example/lib/pages/settings_page.dart +++ b/packages/reown_walletkit/example/lib/pages/settings_page.dart @@ -35,7 +35,7 @@ class _SettingsPageState extends State { final walletKit = GetIt.I().walletKit; await walletKit.core.storage.deleteAll(); ScaffoldMessenger.of(context).showSnackBar( - SnackBar( + const SnackBar( content: Text('Storage cleared'), duration: Duration(seconds: 1), ), @@ -113,7 +113,7 @@ class _SettingsPageState extends State { context: context, builder: (BuildContext context) { return AlertDialog( - content: Text( + content: const Text( 'This will delete the current wallet and create a new one', ), actions: [ @@ -231,11 +231,11 @@ class _LinkModeButton extends StatelessWidget { actions: [ TextButton( onPressed: () => Navigator.of(context).pop(false), - child: Text('Cancel'), + child: const Text('Cancel'), ), TextButton( onPressed: () => Navigator.of(context).pop(true), - child: Text('Ok'), + child: const Text('Ok'), ), ], ); @@ -250,7 +250,7 @@ class _LinkModeButton extends StatelessWidget { }, ); } - return SizedBox.shrink(); + return const SizedBox.shrink(); }, ); } @@ -408,7 +408,7 @@ class _EVMAccountsState extends State<_EVMAccounts> { height: 20.0, errorWidget: (context, url, error) => const SizedBox.shrink(), ), - SizedBox.square(dimension: 8.0), + const SizedBox.square(dimension: 8.0), Expanded( child: Text( 'EVM Accounts (${_currentPage + 1}/${chainKeys.length})', @@ -474,7 +474,7 @@ class _EVMAccountsState extends State<_EVMAccounts> { child: SizedBox( width: 200.0, child: DropdownButton( - key: Key('evm_chains'), + key: const Key('evm_chains'), isExpanded: true, value: _selectedChain, items: ChainsDataList.eip155Chains.map((ChainMetadata chain) { @@ -632,7 +632,7 @@ class _SolanaAccountsState extends State<_SolanaAccounts> { const SizedBox(height: 20.0), const Divider(height: 1.0, color: Colors.black12), Padding( - padding: EdgeInsets.only(left: 12.0, right: 12.0, top: 12.0), + padding: const EdgeInsets.only(left: 12.0, right: 12.0, top: 12.0), child: Row( children: [ CachedNetworkImage( @@ -641,8 +641,8 @@ class _SolanaAccountsState extends State<_SolanaAccounts> { height: 20.0, errorWidget: (context, url, error) => const SizedBox.shrink(), ), - SizedBox.square(dimension: 8.0), - Expanded( + const SizedBox.square(dimension: 8.0), + const Expanded( child: Text( 'solana Accounts', style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.w500), @@ -702,7 +702,7 @@ class _ChainKeyViewState extends State<_ChainKeyView> { const SizedBox(height: 20.0), const Divider(height: 1.0, color: Colors.black12), Padding( - padding: EdgeInsets.only(left: 12.0, top: 12.0, right: 12.0), + padding: const EdgeInsets.only(left: 12.0, top: 12.0, right: 12.0), child: Row( children: [ CachedNetworkImage( @@ -716,11 +716,12 @@ class _ChainKeyViewState extends State<_ChainKeyView> { ); }, ), - SizedBox.square(dimension: 8.0), + const SizedBox.square(dimension: 8.0), Expanded( child: Text( '${widget.chain} account', - style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.w500), + style: const TextStyle( + fontSize: 16.0, fontWeight: FontWeight.w500), ), ), ], @@ -898,7 +899,7 @@ class _Buttons extends StatelessWidget { const SizedBox(height: 8.0), TextButton( onPressed: onDeleteData, - child: Text( + child: const Text( 'Clear local storage', style: TextStyle(color: Colors.black), ), @@ -1016,7 +1017,7 @@ class __DataContainerState extends State<_DataContainer> { (_) => toastification.show( title: Text('${widget.title} copied'), context: context, - autoCloseDuration: Duration(seconds: 2), + autoCloseDuration: const Duration(seconds: 2), alignment: Alignment.bottomCenter, ), ), diff --git a/packages/reown_walletkit/example/lib/utils/constants.dart b/packages/reown_walletkit/example/lib/utils/constants.dart index 99ba7c16..2bd5bf0b 100644 --- a/packages/reown_walletkit/example/lib/utils/constants.dart +++ b/packages/reown_walletkit/example/lib/utils/constants.dart @@ -26,16 +26,16 @@ class StyleConstants { // letterSpacing: -0.6, // -3% of 20px = -0.6 ); - static Color get bgPrimary => Color(0xFFFFFFFF); - static Color get accentPrimary => Color(0xFF0988F0); - static Color get foregroundPrimary => Color(0xFFF3F3F3); - static Color get foregroundSecondary => Color(0xFFE9E9E9); - static Color get neutrals => Color(0xFFBBBBBB); - static Color get textPrimary => Color(0xFF202020); - static Color get textSecondary => Color(0xFF9A9A9A); - static Color get textTertiary => Color(0xFF6C6C6C); - static Color get textSuccess => Color(0xFF30A46B); - static Color get textError => Color(0xFFDF4A34); + static Color get bgPrimary => const Color(0xFFFFFFFF); + static Color get accentPrimary => const Color(0xFF0988F0); + static Color get foregroundPrimary => const Color(0xFFF3F3F3); + static Color get foregroundSecondary => const Color(0xFFE9E9E9); + static Color get neutrals => const Color(0xFFBBBBBB); + static Color get textPrimary => const Color(0xFF202020); + static Color get textSecondary => const Color(0xFF9A9A9A); + static Color get textTertiary => const Color(0xFF6C6C6C); + static Color get textSuccess => const Color(0xFF30A46B); + static Color get textError => const Color(0xFFDF4A34); // Linear static const double linear8 = 8; diff --git a/packages/reown_walletkit/example/lib/utils/methods_utils.dart b/packages/reown_walletkit/example/lib/utils/methods_utils.dart index 2b9fafec..9ffca604 100644 --- a/packages/reown_walletkit/example/lib/utils/methods_utils.dart +++ b/packages/reown_walletkit/example/lib/utils/methods_utils.dart @@ -105,7 +105,7 @@ class MethodsUtils { ), Text( title ?? 'Connected', - style: TextStyle(fontWeight: FontWeight.bold), + style: const TextStyle(fontWeight: FontWeight.bold), ), Text(message ?? 'You can go back to your dApp now'), ], diff --git a/packages/reown_walletkit/example/lib/walletconnect_pay/wcp_modals/wcp_confirming_payment.dart b/packages/reown_walletkit/example/lib/walletconnect_pay/wcp_modals/wcp_confirming_payment.dart index 13cf83a5..463499d5 100644 --- a/packages/reown_walletkit/example/lib/walletconnect_pay/wcp_modals/wcp_confirming_payment.dart +++ b/packages/reown_walletkit/example/lib/walletconnect_pay/wcp_modals/wcp_confirming_payment.dart @@ -46,16 +46,16 @@ class _WCPConfirmingPaymentState extends State { bottom: StyleConstants.linear8, right: StyleConstants.linear8, ), - child: Column( + child: const Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.start, children: [ - const SizedBox(height: StyleConstants.linear48), - const Center(child: WalletConnectLoading(size: 120.0)), - const SizedBox(height: 24.0), + SizedBox(height: StyleConstants.linear48), + Center(child: WalletConnectLoading(size: 120.0)), + SizedBox(height: 24.0), WCModalTitle(text: 'Confirming your payment...'), - const SizedBox(height: StyleConstants.linear24), + SizedBox(height: StyleConstants.linear24), ], ), ); diff --git a/packages/reown_walletkit/example/lib/walletconnect_pay/wcp_modals/wcp_get_payment_options.dart b/packages/reown_walletkit/example/lib/walletconnect_pay/wcp_modals/wcp_get_payment_options.dart index 14f1bc51..ee9705e8 100644 --- a/packages/reown_walletkit/example/lib/walletconnect_pay/wcp_modals/wcp_get_payment_options.dart +++ b/packages/reown_walletkit/example/lib/walletconnect_pay/wcp_modals/wcp_get_payment_options.dart @@ -55,14 +55,14 @@ class _WCPGetPaymentOptionsState extends State { bottom: StyleConstants.linear8, right: StyleConstants.linear8, ), - child: Column( + child: const Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.start, children: [ - const SizedBox(height: StyleConstants.linear48), - const Center(child: WalletConnectLoading(size: 120.0)), - const SizedBox(height: StyleConstants.linear24), + SizedBox(height: StyleConstants.linear48), + Center(child: WalletConnectLoading(size: 120.0)), + SizedBox(height: StyleConstants.linear24), ], ), ); diff --git a/packages/reown_walletkit/example/lib/walletconnect_pay/wcp_modals/wcp_information_capture/wcp_birthdate_capture.dart b/packages/reown_walletkit/example/lib/walletconnect_pay/wcp_modals/wcp_information_capture/wcp_birthdate_capture.dart index 7cb742f1..5e4b4e39 100644 --- a/packages/reown_walletkit/example/lib/walletconnect_pay/wcp_modals/wcp_information_capture/wcp_birthdate_capture.dart +++ b/packages/reown_walletkit/example/lib/walletconnect_pay/wcp_modals/wcp_information_capture/wcp_birthdate_capture.dart @@ -58,7 +58,7 @@ class _WCPBirthdateCaptureState extends State { // totalSteps: 3, // ), const SizedBox(height: StyleConstants.linear24), - WCModalTitle(text: 'What\'s your date of birth?'), + const WCModalTitle(text: 'What\'s your date of birth?'), const SizedBox(height: StyleConstants.linear32), DatePicker( initialDate: _selectedDate, diff --git a/packages/reown_walletkit/example/lib/walletconnect_pay/wcp_modals/wcp_information_capture/wcp_full_name_capture.dart b/packages/reown_walletkit/example/lib/walletconnect_pay/wcp_modals/wcp_information_capture/wcp_full_name_capture.dart index 0d025aed..8efbf773 100644 --- a/packages/reown_walletkit/example/lib/walletconnect_pay/wcp_modals/wcp_information_capture/wcp_full_name_capture.dart +++ b/packages/reown_walletkit/example/lib/walletconnect_pay/wcp_modals/wcp_information_capture/wcp_full_name_capture.dart @@ -80,7 +80,7 @@ class _WCPFullNameCaptureState extends State { mainAxisAlignment: MainAxisAlignment.start, children: [ const SizedBox(height: StyleConstants.linear24), - WCModalTitle(text: 'What\'s your name?'), + const WCModalTitle(text: 'What\'s your name?'), const SizedBox(height: StyleConstants.linear32), WCPTextField( controller: _firstNameController, diff --git a/packages/reown_walletkit/example/lib/walletconnect_pay/wcp_modals/wcp_information_capture/wcp_information_capture_start.dart b/packages/reown_walletkit/example/lib/walletconnect_pay/wcp_modals/wcp_information_capture/wcp_information_capture_start.dart index ccb8cc62..864cd827 100644 --- a/packages/reown_walletkit/example/lib/walletconnect_pay/wcp_modals/wcp_information_capture/wcp_information_capture_start.dart +++ b/packages/reown_walletkit/example/lib/walletconnect_pay/wcp_modals/wcp_information_capture/wcp_information_capture_start.dart @@ -137,7 +137,7 @@ class StepIndicator extends StatelessWidget { Widget build(BuildContext context) { return Column( children: [ - if (isLast) StepLine(height: _topLineHeight), + if (isLast) const StepLine(height: _topLineHeight), Container( margin: !isLast ? const EdgeInsets.only(top: 24.0) : null, width: _circleSize, diff --git a/packages/reown_walletkit/example/lib/walletconnect_pay/wcp_modals/wcp_information_capture/wcp_place_of_birth_capture.dart b/packages/reown_walletkit/example/lib/walletconnect_pay/wcp_modals/wcp_information_capture/wcp_place_of_birth_capture.dart index aa9bd136..932c14c4 100644 --- a/packages/reown_walletkit/example/lib/walletconnect_pay/wcp_modals/wcp_information_capture/wcp_place_of_birth_capture.dart +++ b/packages/reown_walletkit/example/lib/walletconnect_pay/wcp_modals/wcp_information_capture/wcp_place_of_birth_capture.dart @@ -81,7 +81,7 @@ class _WCPPlaceOfBirthCaptureState extends State { mainAxisAlignment: MainAxisAlignment.start, children: [ const SizedBox(height: StyleConstants.linear24), - WCModalTitle(text: 'What is your place of birth?'), + const WCModalTitle(text: 'What is your place of birth?'), const SizedBox(height: StyleConstants.linear32), WCPTextField( controller: _cityController, diff --git a/packages/reown_walletkit/example/lib/walletconnect_pay/wcp_modals/wcp_payment_details.dart b/packages/reown_walletkit/example/lib/walletconnect_pay/wcp_modals/wcp_payment_details.dart index 936182d5..9ed422e1 100644 --- a/packages/reown_walletkit/example/lib/walletconnect_pay/wcp_modals/wcp_payment_details.dart +++ b/packages/reown_walletkit/example/lib/walletconnect_pay/wcp_modals/wcp_payment_details.dart @@ -134,7 +134,7 @@ class DefaultLogo extends StatelessWidget { Widget build(BuildContext context) { return Text( text, - style: TextStyle( + style: const TextStyle( color: Colors.white, fontSize: 32, fontWeight: FontWeight.bold, @@ -243,13 +243,13 @@ class _WCPPaymentOptionDropdownState extends State { formatPayAmount(option.amount), style: StyleConstants.wcpTextPrimaryStyle, ), - Spacer(), + const Spacer(), (widget.selectedOption.id == option.id) ? Icon( Icons.radio_button_on, color: StyleConstants.accentPrimary, ) - : SizedBox.shrink(), + : const SizedBox.shrink(), ], ), ), @@ -286,11 +286,11 @@ class _WCPPaymentOptionDropdownState extends State { color: StyleConstants.foregroundPrimary, borderRadius: BorderRadius.circular(20), ), - constraints: BoxConstraints(minHeight: 64.0), + constraints: const BoxConstraints(minHeight: 64.0), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - if (_isExpanded) SizedBox.square(dimension: 6), + if (_isExpanded) const SizedBox.square(dimension: 6), // Selected option header (always visible, highlighted) InkWell( onTap: hasMultipleOptions diff --git a/packages/reown_walletkit/example/lib/walletconnect_pay/wcp_modals/wcp_payment_result.dart b/packages/reown_walletkit/example/lib/walletconnect_pay/wcp_modals/wcp_payment_result.dart index d2ede716..5f7cfcc7 100644 --- a/packages/reown_walletkit/example/lib/walletconnect_pay/wcp_modals/wcp_payment_result.dart +++ b/packages/reown_walletkit/example/lib/walletconnect_pay/wcp_modals/wcp_payment_result.dart @@ -91,7 +91,7 @@ class _WCPPaymentResultState extends State { height: 40.0, ), const SizedBox(height: StyleConstants.linear24), - WCModalTitle(text: 'Payment failed'), + const WCModalTitle(text: 'Payment failed'), ], ); default: diff --git a/packages/reown_walletkit/example/lib/walletconnect_pay/wcp_shared_widgets.dart b/packages/reown_walletkit/example/lib/walletconnect_pay/wcp_shared_widgets.dart index 6569fa1f..5ea56c06 100644 --- a/packages/reown_walletkit/example/lib/walletconnect_pay/wcp_shared_widgets.dart +++ b/packages/reown_walletkit/example/lib/walletconnect_pay/wcp_shared_widgets.dart @@ -268,7 +268,7 @@ class _DefaultLogo extends StatelessWidget { Widget build(BuildContext context) { return Text( text, - style: TextStyle( + style: const TextStyle( color: Colors.white, fontSize: 32, fontWeight: FontWeight.bold, diff --git a/packages/reown_walletkit/example/lib/widgets/pairing_item.dart b/packages/reown_walletkit/example/lib/widgets/pairing_item.dart index 94c928ff..c3817bfd 100644 --- a/packages/reown_walletkit/example/lib/widgets/pairing_item.dart +++ b/packages/reown_walletkit/example/lib/widgets/pairing_item.dart @@ -41,10 +41,10 @@ class PairingItem extends StatelessWidget { padding: const EdgeInsets.all(1.0), decoration: BoxDecoration( border: Border.all(width: 1.0, color: Colors.grey), - borderRadius: BorderRadius.all(Radius.circular(20.0)), + borderRadius: const BorderRadius.all(Radius.circular(20.0)), ), child: ClipRRect( - borderRadius: BorderRadius.all(Radius.circular(20.0)), + borderRadius: const BorderRadius.all(Radius.circular(20.0)), child: SvgPicture.network(imageUrl), ), ); @@ -53,7 +53,7 @@ class PairingItem extends StatelessWidget { backgroundImage: CachedNetworkImageProvider(imageUrl), ); } - return CircleAvatar(backgroundColor: Colors.black12); + return const CircleAvatar(backgroundColor: Colors.black12); }, ), title: Text(metadata.name), diff --git a/packages/reown_walletkit/example/lib/widgets/uri_input_popup.dart b/packages/reown_walletkit/example/lib/widgets/uri_input_popup.dart index c0415a20..65a8eff9 100644 --- a/packages/reown_walletkit/example/lib/widgets/uri_input_popup.dart +++ b/packages/reown_walletkit/example/lib/widgets/uri_input_popup.dart @@ -23,7 +23,8 @@ class UriInputPopup extends StatelessWidget { padding: const EdgeInsets.symmetric(vertical: 20.0), child: Column( children: [ - Text(StringConstants.enterUri, style: TextStyle(fontSize: 18.0)), + const Text(StringConstants.enterUri, + style: TextStyle(fontSize: 18.0)), const Text( StringConstants.enterUriMessage, textAlign: TextAlign.center, @@ -39,7 +40,7 @@ class UriInputPopup extends StatelessWidget { enableSuggestions: false, autocorrect: false, cursorHeight: 16.0, - style: TextStyle(color: Colors.black), + style: const TextStyle(color: Colors.black), decoration: InputDecoration( isDense: true, hintText: 'wc://as87d6...', diff --git a/packages/reown_walletkit/example/lib/widgets/wc_connection_request/wc_connection_request_widget.dart b/packages/reown_walletkit/example/lib/widgets/wc_connection_request/wc_connection_request_widget.dart index 283c4873..0fd88d05 100644 --- a/packages/reown_walletkit/example/lib/widgets/wc_connection_request/wc_connection_request_widget.dart +++ b/packages/reown_walletkit/example/lib/widgets/wc_connection_request/wc_connection_request_widget.dart @@ -43,7 +43,7 @@ class WCConnectionRequestWidget extends StatelessWidget { const SizedBox(height: StyleConstants.linear8), Text( '${requester!.metadata.name} ${StringConstants.wouldLikeToConnect}', - style: TextStyle(fontSize: 18.0, fontWeight: FontWeight.bold), + style: const TextStyle(fontSize: 18.0, fontWeight: FontWeight.bold), textAlign: TextAlign.center, ), const SizedBox(height: StyleConstants.linear8), diff --git a/packages/reown_walletkit/example/lib/widgets/wc_connection_widget/wc_connection_widget_info.dart b/packages/reown_walletkit/example/lib/widgets/wc_connection_widget/wc_connection_widget_info.dart index 25617bfd..d8348c99 100644 --- a/packages/reown_walletkit/example/lib/widgets/wc_connection_widget/wc_connection_widget_info.dart +++ b/packages/reown_walletkit/example/lib/widgets/wc_connection_widget/wc_connection_widget_info.dart @@ -40,7 +40,7 @@ class WCConnectionWidgetInfo extends StatelessWidget { Widget _buildElement(String text) { if (text.isEmpty) { - return SizedBox.shrink(); + return const SizedBox.shrink(); } return ElevatedButton( onPressed: diff --git a/packages/reown_walletkit/ios/Flutter/Generated.xcconfig b/packages/reown_walletkit/ios/Flutter/Generated.xcconfig index 71225d4e..d708adb4 100644 --- a/packages/reown_walletkit/ios/Flutter/Generated.xcconfig +++ b/packages/reown_walletkit/ios/Flutter/Generated.xcconfig @@ -1,6 +1,6 @@ // This is a generated file; do not edit or check into version control. FLUTTER_ROOT=/Users/alfreedom/Development/flutter -FLUTTER_APPLICATION_PATH=/Users/alfreedom/Development/reown_flutter_bkp/packages/reown_walletkit +FLUTTER_APPLICATION_PATH=/Users/alfreedom/Development/reown_flutter/packages/reown_walletkit COCOAPODS_PARALLEL_CODE_SIGN=true FLUTTER_TARGET=lib/main.dart FLUTTER_BUILD_DIR=build diff --git a/packages/reown_walletkit/ios/Flutter/flutter_export_environment.sh b/packages/reown_walletkit/ios/Flutter/flutter_export_environment.sh index 01f87bd3..56c5bf98 100755 --- a/packages/reown_walletkit/ios/Flutter/flutter_export_environment.sh +++ b/packages/reown_walletkit/ios/Flutter/flutter_export_environment.sh @@ -1,7 +1,7 @@ #!/bin/sh # This is a generated file; do not edit or check into version control. export "FLUTTER_ROOT=/Users/alfreedom/Development/flutter" -export "FLUTTER_APPLICATION_PATH=/Users/alfreedom/Development/reown_flutter_bkp/packages/reown_walletkit" +export "FLUTTER_APPLICATION_PATH=/Users/alfreedom/Development/reown_flutter/packages/reown_walletkit" export "COCOAPODS_PARALLEL_CODE_SIGN=true" export "FLUTTER_TARGET=lib/main.dart" export "FLUTTER_BUILD_DIR=build" diff --git a/packages/reown_walletkit/pubspec.yaml b/packages/reown_walletkit/pubspec.yaml index fcf87d51..c127c83c 100644 --- a/packages/reown_walletkit/pubspec.yaml +++ b/packages/reown_walletkit/pubspec.yaml @@ -13,9 +13,12 @@ dependencies: event: ^3.1.0 flutter: sdk: flutter - reown_core: ^1.3.8 - reown_sign: ^1.3.9 - walletconnect_pay: ^1.0.0 + reown_core: + path: ../reown_core/ + reown_sign: + path: ../reown_sign/ + walletconnect_pay: + path: ../walletconnect_pay/ dev_dependencies: build_runner: ^2.4.13 @@ -27,4 +30,5 @@ dev_dependencies: logger: ^2.5.0 mockito: ^5.4.4 package_info_plus: '>=8.1.2 <10.0.0' - reown_appkit: ^1.8.0 + reown_appkit: + path: ../reown_appkit/ diff --git a/packages/reown_yttrium/analysis_options.yaml b/packages/reown_yttrium/analysis_options.yaml index b677fc6a..ac988f21 100644 --- a/packages/reown_yttrium/analysis_options.yaml +++ b/packages/reown_yttrium/analysis_options.yaml @@ -29,6 +29,9 @@ linter: sort_pub_dependencies: true avoid_unnecessary_containers: true cancel_subscriptions: true + prefer_const_constructors: true + # prefer_const_literals_to_create_immutables: true + avoid_field_initializers_in_const_classes: true analyzer: exclude: diff --git a/packages/reown_yttrium_utils/analysis_options.yaml b/packages/reown_yttrium_utils/analysis_options.yaml index b677fc6a..ac988f21 100644 --- a/packages/reown_yttrium_utils/analysis_options.yaml +++ b/packages/reown_yttrium_utils/analysis_options.yaml @@ -29,6 +29,9 @@ linter: sort_pub_dependencies: true avoid_unnecessary_containers: true cancel_subscriptions: true + prefer_const_constructors: true + # prefer_const_literals_to_create_immutables: true + avoid_field_initializers_in_const_classes: true analyzer: exclude: diff --git a/packages/walletconnect_pay/analysis_options.yaml b/packages/walletconnect_pay/analysis_options.yaml index b677fc6a..ac988f21 100644 --- a/packages/walletconnect_pay/analysis_options.yaml +++ b/packages/walletconnect_pay/analysis_options.yaml @@ -29,6 +29,9 @@ linter: sort_pub_dependencies: true avoid_unnecessary_containers: true cancel_subscriptions: true + prefer_const_constructors: true + # prefer_const_literals_to_create_immutables: true + avoid_field_initializers_in_const_classes: true analyzer: exclude: diff --git a/packages/walletconnect_pay/example/lib/main.dart b/packages/walletconnect_pay/example/lib/main.dart index 0daf0e35..90f5fbe7 100644 --- a/packages/walletconnect_pay/example/lib/main.dart +++ b/packages/walletconnect_pay/example/lib/main.dart @@ -59,7 +59,7 @@ class _PaymentPageState extends State { } Future _initSdk() async { - _payClient = WalletConnectPay(apiKey: PaymentPage.wcpApiKey); + _payClient = const WalletConnectPay(apiKey: PaymentPage.wcpApiKey); try { final success = await _payClient.init(); setState(() => _isInitialized = success); diff --git a/packages/walletconnect_pay/test/walletconnect_pay_exceptions_test.dart b/packages/walletconnect_pay/test/walletconnect_pay_exceptions_test.dart index dddad014..f0e0b241 100644 --- a/packages/walletconnect_pay/test/walletconnect_pay_exceptions_test.dart +++ b/packages/walletconnect_pay/test/walletconnect_pay_exceptions_test.dart @@ -1,6 +1,5 @@ import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:walletconnect_pay/models/walletconnect_pay_exceptions.dart'; import 'package:walletconnect_pay/walletconnect_pay.dart'; import 'package:walletconnect_pay/walletconnect_pay_platform_interface.dart'; import 'package:plugin_platform_interface/plugin_platform_interface.dart'; @@ -264,7 +263,10 @@ void main() { late MockWalletconnectPayPlatformWithErrors mockPlatform; setUp(() { - walletconnectPayPlugin = WalletConnectPay(appId: 'test', apiKey: 'test'); + walletconnectPayPlugin = const WalletConnectPay( + appId: 'test', + apiKey: 'test', + ); mockPlatform = MockWalletconnectPayPlatformWithErrors(); WalletconnectPayPlatform.instance = mockPlatform; }); @@ -276,7 +278,7 @@ void main() { expect( () => walletconnectPayPlugin.getPaymentOptions( - request: GetPaymentOptionsRequest( + request: const GetPaymentOptionsRequest( paymentLink: 'pay_nonexistent', accounts: ['eip155:1:0x123'], ), @@ -292,7 +294,7 @@ void main() { expect( () => walletconnectPayPlugin.getPaymentOptions( - request: GetPaymentOptionsRequest( + request: const GetPaymentOptionsRequest( paymentLink: 'pay_expired', accounts: ['eip155:1:0x123'], ), @@ -311,7 +313,7 @@ void main() { expect( () => walletconnectPayPlugin.getRequiredPaymentActions( - request: GetRequiredPaymentActionsRequest( + request: const GetRequiredPaymentActionsRequest( paymentId: 'pay_123', optionId: 'opt_456', ), @@ -330,7 +332,7 @@ void main() { expect( () => walletconnectPayPlugin.confirmPayment( - request: ConfirmPaymentRequest( + request: const ConfirmPaymentRequest( paymentId: 'pay_123', optionId: 'opt_456', signatures: ['0xsig'], @@ -344,7 +346,7 @@ void main() { // Test that invalid JSON throws FormatException expect( () => walletconnectPayPlugin.getPaymentOptions( - request: GetPaymentOptionsRequest( + request: const GetPaymentOptionsRequest( paymentLink: 'pay_123', accounts: [], ), diff --git a/packages/walletconnect_pay/test/walletconnect_pay_json_test.dart b/packages/walletconnect_pay/test/walletconnect_pay_json_test.dart index 3cc31042..8dc0deb3 100644 --- a/packages/walletconnect_pay/test/walletconnect_pay_json_test.dart +++ b/packages/walletconnect_pay/test/walletconnect_pay_json_test.dart @@ -74,7 +74,7 @@ void main() { late MockWalletconnectPayPlatform mockPlatform; setUp(() { - walletconnectPayPlugin = WalletConnectPay(appId: '', apiKey: ''); + walletconnectPayPlugin = const WalletConnectPay(appId: '', apiKey: ''); mockPlatform = MockWalletconnectPayPlatform(); WalletconnectPayPlatform.instance = mockPlatform; }); @@ -118,7 +118,7 @@ void main() { mockPlatform.setGetPaymentOptionsResponse(jsonEncode(mockResponse)); final result = await walletconnectPayPlugin.getPaymentOptions( - request: GetPaymentOptionsRequest( + request: const GetPaymentOptionsRequest( paymentLink: 'https://pay.example.com/pay_json_123', accounts: ['eip155:8453:0xabc'], ), @@ -137,7 +137,7 @@ void main() { expect( () => walletconnectPayPlugin.getPaymentOptions( - request: GetPaymentOptionsRequest( + request: const GetPaymentOptionsRequest( paymentLink: 'https://pay.example.com/pay', accounts: ['eip155:1:0x123'], ), @@ -194,14 +194,14 @@ void main() { ); await walletconnectPayPlugin.getPaymentOptions( - request: GetPaymentOptionsRequest( + request: const GetPaymentOptionsRequest( paymentLink: 'pay_json_456', accounts: ['eip155:1:0x123'], ), ); final actions = await walletconnectPayPlugin.getRequiredPaymentActions( - request: GetRequiredPaymentActionsRequest( + request: const GetRequiredPaymentActionsRequest( paymentId: 'pay_json_456', optionId: 'opt_json_2', ), @@ -227,7 +227,7 @@ void main() { mockPlatform.setConfirmPaymentResponse(jsonEncode(confirmResponse)); final result = await walletconnectPayPlugin.confirmPayment( - request: ConfirmPaymentRequest( + request: const ConfirmPaymentRequest( paymentId: 'pay_json_789', optionId: 'opt_1', signatures: ['0x123'], @@ -264,7 +264,7 @@ void main() { test('test_json_get_payment_options_empty_payment_link', () async { // In Dart, we validate at the model level, but the platform might also validate // This test ensures the request can be created (validation happens elsewhere) - final request = GetPaymentOptionsRequest( + final request = const GetPaymentOptionsRequest( paymentLink: '', accounts: ['eip155:1:0x123'], ); @@ -276,7 +276,7 @@ void main() { test('test_json_get_payment_options_empty_accounts', () async { // Similar to above, validation happens at platform level - final request = GetPaymentOptionsRequest( + final request = const GetPaymentOptionsRequest( paymentLink: 'pay_123', accounts: [], ); @@ -287,7 +287,7 @@ void main() { test('test_json_confirm_payment_empty_payment_id', () async { // Validation happens at platform level - final request = ConfirmPaymentRequest( + final request = const ConfirmPaymentRequest( paymentId: '', optionId: 'opt_1', signatures: [], @@ -307,7 +307,7 @@ void main() { mockPlatform.setConfirmPaymentResponse(jsonEncode(confirmResponse)); final result = await walletconnectPayPlugin.confirmPayment( - request: ConfirmPaymentRequest( + request: const ConfirmPaymentRequest( paymentId: 'pay_123', optionId: 'opt_1', signatures: ['0xsignature1', '0xsignature2'], @@ -325,7 +325,7 @@ void main() { test('test_json_get_required_payment_actions_empty_payment_id', () async { // Validation happens at platform level - final request = GetRequiredPaymentActionsRequest( + final request = const GetRequiredPaymentActionsRequest( paymentId: '', optionId: 'opt_1', ); @@ -336,7 +336,7 @@ void main() { test('test_json_get_required_payment_actions_empty_option_id', () async { // Validation happens at platform level - final request = GetRequiredPaymentActionsRequest( + final request = const GetRequiredPaymentActionsRequest( paymentId: 'pay_123', optionId: '', ); @@ -394,7 +394,7 @@ void main() { mockPlatform.setGetPaymentOptionsResponse(jsonEncode(mockResponse)); final result = await walletconnectPayPlugin.getPaymentOptions( - request: GetPaymentOptionsRequest( + request: const GetPaymentOptionsRequest( paymentLink: 'https://pay.example.com/pay_123', accounts: ['eip155:1:0xabc'], includePaymentInfo: true, diff --git a/packages/walletconnect_pay/test/walletconnect_pay_test.dart b/packages/walletconnect_pay/test/walletconnect_pay_test.dart index 155c65c2..e3ba9e0e 100644 --- a/packages/walletconnect_pay/test/walletconnect_pay_test.dart +++ b/packages/walletconnect_pay/test/walletconnect_pay_test.dart @@ -44,7 +44,7 @@ void main() { }); test('initialize', () async { - WalletConnectPay walletconnectPayPlugin = WalletConnectPay( + WalletConnectPay walletconnectPayPlugin = const WalletConnectPay( appId: 'test-project-id', apiKey: 'test-api-key', ); @@ -55,7 +55,7 @@ void main() { }); test('confirmPayment', () async { - WalletConnectPay walletconnectPayPlugin = WalletConnectPay( + WalletConnectPay walletconnectPayPlugin = const WalletConnectPay( appId: 'test-project-id', apiKey: 'test-api-key', ); @@ -63,7 +63,7 @@ void main() { WalletconnectPayPlatform.instance = fakePlatform; final result = await walletconnectPayPlugin.confirmPayment( - request: ConfirmPaymentRequest( + request: const ConfirmPaymentRequest( paymentId: 'test-payment-id', optionId: 'test-option-id', signatures: ['test-signature'], @@ -74,7 +74,7 @@ void main() { }); test('getPaymentOptions', () async { - WalletConnectPay walletconnectPayPlugin = WalletConnectPay( + WalletConnectPay walletconnectPayPlugin = const WalletConnectPay( appId: 'test-project-id', apiKey: 'test-api-key', ); @@ -82,7 +82,7 @@ void main() { WalletconnectPayPlatform.instance = fakePlatform; final result = await walletconnectPayPlugin.getPaymentOptions( - request: GetPaymentOptionsRequest( + request: const GetPaymentOptionsRequest( paymentLink: 'https://test.com/pay', accounts: ['0x123'], ), @@ -91,7 +91,7 @@ void main() { }); test('getRequiredPaymentActions', () async { - WalletConnectPay walletconnectPayPlugin = WalletConnectPay( + WalletConnectPay walletconnectPayPlugin = const WalletConnectPay( appId: 'test-project-id', apiKey: 'test-api-key', ); @@ -99,7 +99,7 @@ void main() { WalletconnectPayPlatform.instance = fakePlatform; final result = await walletconnectPayPlugin.getRequiredPaymentActions( - request: GetRequiredPaymentActionsRequest( + request: const GetRequiredPaymentActionsRequest( optionId: 'test-option-id', paymentId: 'test-payment-id', ),