WalletConnect / Web3ModalFlutter

The Web3Modal for WalletConnect built using Flutter.
https://pub.dev/packages/web3modal_flutter
Apache License 2.0
28 stars 30 forks source link

includedWalletIds option causing an exception #56

Closed anthonygregis closed 6 months ago

anthonygregis commented 6 months ago

Describe the bug When providing a includedWalletIds option that includes the Metamask and Uniswap Wallet ids it results in an error. If you provide an includedWalletIds option of just Metamask it instead returns all the regular featured options and not just Metamask.

To Reproduce Steps to reproduce the behavior:

  1. Configure includedWalletIds with the following values
    {
    'c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96', // MetaMask
    'c03dfee351b6fcc421b4494ea33b9d4b92a984f87aa76d1663bb28705e95034a', // Uniswap
    };
  2. Include this option in your W3MService
    W3MService(web3App: web3App, includedWalletIds: featuredWalletIds);
  3. See error

Expected behavior A clear way to set a list of included wallet options and be able to provide any wallet option without it crashing.

Screenshots If applicable, add screenshots to help explain your problem.

Smartphone (please complete the following information):

Additional context Stack

════════ Exception caught by widgets library ═══════════════════════════════════
The following RangeError was thrown building ValueListenableBuilder<List<W3MWalletInfo>>(dirty, state: _ValueListenableBuilderState<List<W3MWalletInfo>>#143a1):
RangeError (end): Invalid value: Not in inclusive range 0..2: 4

The relevant error-causing widget was
MaterialApp
main.dart:94
When the exception was thrown, this was the stack
#0      RangeError.checkValidRange (dart:core/errors.dart:365:9)
#1      ListBase.getRange (dart:collection/list.dart:356:16)
#2      _WalletsListShortPageState.build.<anonymous closure>
#3      _ExplorerServiceItemsListenerState.build.<anonymous closure>.<anonymous closure>
explorer_service_items_listener.dart:43
#4      _ValueListenableBuilderState.build
value_listenable_builder.dart:186
#5      StatefulElement.build
framework.dart:5409
#6      ComponentElement.performRebuild
framework.dart:5297
#7      StatefulElement.performRebuild
framework.dart:5462
#8      Element.rebuild
framework.dart:5016
#9      BuildOwner.buildScope
framework.dart:2779
#10     WidgetsBinding.drawFrame
binding.dart:916
#11     RendererBinding._handlePersistentFrameCallback
binding.dart:360
#12     SchedulerBinding._invokeFrameCallback
binding.dart:1297
#13     SchedulerBinding.handleDrawFrame
binding.dart:1227
#14     SchedulerBinding._handleDrawFrame
binding.dart:1085
#15     _invoke (dart:ui/hooks.dart:170:13)
#16     PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:401:5)
#17     _drawFrame (dart:ui/hooks.dart:140:31)
quetool commented 6 months ago

Thank you @anthonygregis! Working on a fix that will be deployed, hopefully, today.

quetool commented 6 months ago

Hello @anthonygregis ! Issue has been fixed in latest beta

dependencies:
  web3modal_flutter: ^3.0.0-beta18