From a2b39b6d379d4bfbe90e1bd0fdbcfe30e6fb4dd2 Mon Sep 17 00:00:00 2001 From: Aasim Khan Date: Thu, 22 Feb 2024 13:32:01 +0400 Subject: [PATCH] feat: Added service listener in web3_service in `mirai_web3` --- packages/mirai_web3/lib/services/web_modal_service.dart | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/mirai_web3/lib/services/web_modal_service.dart b/packages/mirai_web3/lib/services/web_modal_service.dart index 868cc12f..3894d686 100644 --- a/packages/mirai_web3/lib/services/web_modal_service.dart +++ b/packages/mirai_web3/lib/services/web_modal_service.dart @@ -9,6 +9,7 @@ import 'package:mirai_web3/models/token.dart'; import 'package:mirai_web3/models/transaction_details.dart'; import 'package:mirai_web3/utils/extensions.dart'; import 'package:web3modal_flutter/pages/select_network_page.dart'; +import 'package:web3modal_flutter/services/w3m_service/i_w3m_service.dart'; import 'package:web3modal_flutter/web3modal_flutter.dart'; import 'package:web3modal_flutter/widgets/widget_stack/widget_stack_singleton.dart'; @@ -34,6 +35,7 @@ class Web3ModalService { ChainMetadata? metadata, List customChains = const [], List contractsList = const [], + void Function(W3MServiceStatus status)? listener, }) async { _chainMetadata = metadata ?? const ChainMetadata( @@ -66,6 +68,9 @@ class Web3ModalService { ), ); await _service.init(); + _service.addListener(() { + listener?.call(_service.status); + }); isInitialize = true; } catch (e) {