restoreConnection method
Try to restore existing session and reconnect to the corresponding wallet. Call it immediately when your app is loaded.
Implementation
Future<bool> restoreConnection() async {
try {
provider = BridgeProvider(storage);
} catch (e) {
await storage.removeItem(key: IStorage.keyConnection);
provider = null;
}
if (provider == null) {
return false;
}
provider!.listen(_walletEventsListener);
return await provider!.restoreConnection();
}