init method
Implementation
@override
Future<void> init() async {
if (!_enabled) return;
// Configure SDK for each platform
_walletData =
(await _explorerService.getCoinbaseWalletObject()) ?? defaultWalletData;
final imageId = defaultWalletData.listing.imageId;
_iconImage = _explorerService.getWalletImageUrl(imageId);
final walletLink = _walletData.listing.mobileLink ?? '';
final redirect = _metadata.redirect;
final callback = redirect?.universal ?? redirect?.native ?? '';
_core.logger.i(
'[$runtimeType] init with host: ${Uri.parse(walletLink)}, callback: ${Uri.parse(callback)}',
);
if (callback.isNotEmpty || walletLink.isNotEmpty) {
try {
final config = Configuration(
ios: IOSConfiguration(
host: Uri.parse(walletLink),
callback: Uri.parse(callback),
),
android: AndroidConfiguration(
domain: Uri.parse(callback),
),
);
await CoinbaseWalletSDK.shared.configure(config);
} catch (_) {
// Silent error
}
} else {
_enabled = false;
_core.logger.e('[$runtimeType] Initialization error');
throw CoinbaseServiceException('Initialization error');
}
}