Web3ModalService class
- Inheritance
-
- Object
- ChangeNotifier
- Web3ModalService
- Implemented types
Constructors
-
Web3ModalService({IWeb3App? web3App, String? projectId, PairingMetadata? metadata, Map<
String, RequiredNamespace> ? requiredNamespaces, IExplorerService? explorerService, Set<String> ? recommendedWalletIds, ExcludedWalletState excludedWalletState = ExcludedWalletState.list, Set<String> ? excludedWalletIds}) -
Creates a new instance of Web3ModalService.
web3Appis optional and can be used to pass in an already createdWeb3App.projectIdandmetadataare optional and can be used to create a newWeb3App. You must provide either aprojectIdandmetadataor an already createdweb3App, or this will throw an ArgumentError.requiredNamespacesis optional and can be used to pass in a custom set of required namespaces.explorerServiceis optional and can be used to pass in a custom IExplorerService.recommendedWalletIdsis optional and can be used to pass in a custom set of recommended wallet IDs.excludedWalletStateis optional and can be used to pass in a custom ExcludedWalletState.excludedWalletIdsis optional and can be used to pass in a custom set of excluded wallet IDs.
Properties
- address → String?
-
The address of the currently connected account.
no setteroverride
- connectResponse ↔ ConnectResponse?
-
getter/setter pair
- context ↔ BuildContext?
-
getter/setter pair
-
didDispose
→ Future<
Null> -
A Future that will complete when this object has been disposed.
no setterinherited
- disposableTypeName → String
-
A type name, similar to runtimeType but intended to work
with minified code.
no setterinherited
- disposalTreeSize → int
-
The total size of the disposal tree rooted at the current Disposable
instance.
no setterinherited
- explorerService ↔ IExplorerService
-
The service used to fetch wallet listings from the explorer API.
getter/setter pairoverride-getter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- isConnected → bool
-
Variable that can be used to check if the web3App is connected
no setteroverride
- isDisposed → bool
-
Whether this object has been disposed.
no setterinherited
- isInitialized → bool
-
Whether or not this object has been initialized.
no setteroverride
- isLeakFlagSet → bool
-
Whether the leak flag for this object has been set.
no setterinherited
- isOpen → bool
-
Variable that can be used to check if the modal is visible on screen.
no setteroverride
- isOrWillBeDisposed → bool
-
Whether the disposal of this object has been requested, is in progress, or
is complete.
no setterinherited
- projectId → String
-
The project ID used to initialize the web3App.
no setteroverride
-
requiredNamespaces
→ Map<
String, RequiredNamespace> -
The required namespaces that will be used when connecting to the wallet
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- session → SessionData?
-
The current session's data.
no setteroverride
- wcUri → String?
-
The URI that can be used to connect to this dApp.
This is only available after the open function is called.
no setteroverride
- web3App → IWeb3App?
-
The object that manages sessions, authentication, events, and requests
for WalletConnect.
no setteroverride
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
awaitBeforeDispose<
T> (Future< T> future) → Future<T> -
Add
futureto a list of futures that will be awaited before the object is disposed.inherited -
close(
) → void -
Closes the modal.
override
-
disconnect(
) → Future< void> -
Disconnects the session and pairing, if any.
If there is no session, this does nothing.
override
-
dispose(
) → Future< Null> -
Dispose of the object, cleaning up to prevent memory leaks.
inherited
-
flagLeak(
[String? description]) → void -
Flag the object as having been disposed in a way that allows easier
profiling.
inherited
-
getManagedDelayedFuture<
T> (Duration duration, T callback()) → Future< T> -
Creates a Future that will complete, with the value
returned by
callback, after the given amount of time has elapsed.inherited -
getManagedDisposer(
Disposer disposer) → ManagedDisposer -
Automatically handle arbitrary disposals using a callback.
inherited
-
getManagedPeriodicTimer(
Duration duration, void callback(Timer timer)) → Timer -
Creates a periodic Timer that will be cancelled if active
upon disposal.
inherited
-
getManagedTimer(
Duration duration, void callback()) → Timer -
Creates a Timer instance that will be cancelled if active
upon disposal.
inherited
-
getReferer(
) → String -
Gets the name of the currently connected wallet.
override
-
init(
) → Future< void> -
The current connection state of the modal.
Used by the connect button to render the correct UI.
The current state of the modal.
The list of wallets from the explorer API.
Sets up the explorer and the web3App if they already been initialized.
override
-
launchCurrentWallet(
) → void -
override
-
listenToStream<
T> (Stream< T> stream, void onData(T event), {Function? onError, void onDone()?, bool? cancelOnError}) → StreamSubscription<T> -
Returns a StreamSubscription which handles events from the stream using
the provided
onData,onErrorandonDonehandlers.inherited -
manageAndReturnTypedDisposable<
T extends Disposable> (T disposable) → T -
Automatically dispose another object when this object is disposed.
inherited
-
manageCompleter<
T> (Completer< T> completer) → Completer<T> -
Ensure that a completer is completed when the object is disposed.
inherited
-
manageDisposable(
Disposable disposable) → void -
inherited
-
manageStreamController(
StreamController controller) → void -
Automatically cancel a stream controller when this object is disposed.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
onDispose(
) → Future< Null> - Callback to allow arbitrary cleanup on dispose.
-
onWillDispose(
) → Future< Null> -
Callback to allow arbitrary cleanup as soon as disposal is requested (i.e.
disposeis called) but prior to disposal actually starting.inherited -
open(
{required BuildContext context, Web3ModalState? startState}) → Future< void> -
Opens the modal with the provided
startState. If none is provided, the default state will be used based on platform.override -
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
setDefaultChain(
{Web3ModalChains? web3modalChain, Map< String, RequiredNamespace> ? requiredNamespaces}) → void -
Sets the default chain to use for the session.
web3modalChainorrequiredNamespacesmust be provided, if both are null this function will do nothing.override -
setRequiredNamespaces(
Map< String, RequiredNamespace> namespaces) → void -
Sets the required namespaces that will be used when connecting to the wallet
The default is set to the NamespaceConstants.ethereum namespace.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited