ReownAppKitModal constructor
ReownAppKitModal({
- required BuildContext context,
- IReownAppKit? appKit,
- String? projectId,
- PairingMetadata? metadata,
- SIWEConfig? siweConfig,
- Map<
String, RequiredNamespace> ? requiredNamespaces, - Map<
String, RequiredNamespace> ? optionalNamespaces, - Set<
String> ? featuredWalletIds, - Set<
String> ? includedWalletIds, - Set<
String> ? excludedWalletIds, - bool? enableAnalytics,
- bool enableEmail = false,
- List<
ReownAppKitModalNetworkInfo> blockchains = const [], - LogLevel logLevel = LogLevel.nothing,
Implementation
ReownAppKitModal({
required BuildContext context,
IReownAppKit? appKit,
String? projectId,
PairingMetadata? metadata,
SIWEConfig? siweConfig,
Map<String, RequiredNamespace>? requiredNamespaces,
Map<String, RequiredNamespace>? optionalNamespaces,
Set<String>? featuredWalletIds,
Set<String>? includedWalletIds,
Set<String>? excludedWalletIds,
bool? enableAnalytics,
bool enableEmail = false,
List<ReownAppKitModalNetworkInfo> blockchains = const [],
LogLevel logLevel = LogLevel.nothing,
}) {
if (appKit == null) {
if (projectId == null) {
throw ReownAppKitModalException(
'Either a `projectId` and `metadata` must be provided or an already created `appKit`',
);
}
if (metadata == null) {
throw ReownAppKitModalException(
'`metadata:` parameter is required when using `projectId:`',
);
}
}
// if (siweConfig?.enabled == true && context == null) {
// throw ReownAppKitModalException(
// '`context:` parameter is required if using `siweConfig:`. Also, `context:` parameter will be enforced in future versions.',
// );
// }
_context = context;
_appKit = appKit ??
ReownAppKit(
core: ReownCore(projectId: projectId!),
metadata: metadata!,
);
_projectId = _appKit.core.projectId;
_setRequiredNamespaces(requiredNamespaces);
_setOptionalNamespaces(optionalNamespaces);
uriService.instance = UriService(
core: _appKit.core,
);
analyticsService.instance = AnalyticsService(
core: _appKit.core,
enableAnalytics: enableAnalytics,
)..init().then((_) {
analyticsService.instance.sendEvent(ModalLoadedEvent());
});
explorerService.instance = ExplorerService(
core: _appKit.core,
referer: _appKit.metadata.name.replaceAll(' ', ''),
featuredWalletIds: featuredWalletIds,
includedWalletIds: includedWalletIds,
excludedWalletIds: excludedWalletIds,
);
blockchainService.instance = BlockChainService(
core: _appKit.core,
);
magicService.instance = MagicService(
core: _appKit.core,
metadata: _appKit.metadata,
enabled: enableEmail,
);
coinbaseService.instance = CoinbaseService(
core: _appKit.core,
metadata: _appKit.metadata,
enabled: _initializeCoinbaseSDK,
);
siweService.instance = SiweService(
appKit: _appKit,
siweConfig: siweConfig,
);
}