ReownAppKitModal constructor
ReownAppKitModal({
- required BuildContext context,
- IReownAppKit? appKit,
- String? projectId,
- PairingMetadata? metadata,
- bool? enableAnalytics,
- SIWEConfig? siweConfig,
- FeaturesConfig? featuresConfig,
- @Deprecated('requiredNamespaces are automatically assigned to optionalNamespaces. Considering using only optionalNamespaces') Map<
String, RequiredNamespace> ? requiredNamespaces, - Map<
String, RequiredNamespace> ? optionalNamespaces, - Set<
String> ? featuredWalletIds, - Set<
String> ? includedWalletIds, - Set<
String> ? excludedWalletIds, - Future<
double> getBalanceFallback()?, - LogLevel logLevel = LogLevel.nothing,
- bool disconnectOnDispose = true,
- List<
ReownAppKitModalWalletInfo> customWallets = const [],
Implementation
ReownAppKitModal({
required BuildContext context,
IReownAppKit? appKit,
String? projectId,
PairingMetadata? metadata,
bool? enableAnalytics,
SIWEConfig? siweConfig,
FeaturesConfig? featuresConfig,
@Deprecated(
'requiredNamespaces are automatically assigned to optionalNamespaces. Considering using only optionalNamespaces',
)
Map<String, RequiredNamespace>? requiredNamespaces,
Map<String, RequiredNamespace>? optionalNamespaces,
Set<String>? featuredWalletIds,
Set<String>? includedWalletIds,
Set<String>? excludedWalletIds,
Future<double> Function()? getBalanceFallback,
LogLevel logLevel = LogLevel.nothing,
bool disconnectOnDispose = true,
List<ReownAppKitModalWalletInfo> customWallets = const [],
}) {
if (appKit == null) {
if (projectId == null) {
throw ReownAppKitModalException(
'Either a `projectId` and `metadata` must be provided or an already created `appKit` instance. '
'See https://docs.reown.com/appkit/flutter/core/usage#initialization',
);
}
if (metadata == null) {
throw ReownAppKitModalException(
'`metadata:` parameter is required when using `projectId:`. '
'See https://docs.reown.com/appkit/flutter/core/usage#initialization',
);
}
}
this.featuresConfig = featuresConfig ?? FeaturesConfig();
_context = context;
_getBalance = getBalanceFallback;
_disconnectOnDispose = disconnectOnDispose;
_customWallets = customWallets;
_appKit =
appKit ??
ReownAppKit(
core: ReownCore(projectId: projectId!, logLevel: logLevel),
metadata: metadata!,
);
_projectId = _appKit.core.projectId;
_setOptionalNamespaces(
_buildNamespaces(requiredNamespaces, optionalNamespaces),
);
_registerServices(
analyticsEnabled: enableAnalytics,
featuredWalletIds: featuredWalletIds,
includedWalletIds: includedWalletIds,
excludedWalletIds: excludedWalletIds,
siweConfig: siweConfig,
);
}