Skip to main content

Function Signature

Future<bool> isWalletOnDevice([String? chainId])

Description

Checks if the wallet signing shares are stored on the current device.

Parameters

ParameterTypeRequiredDescription
chainIdStringNoOptional chain ID to check. If null, checks for any wallet.

Returns

bool - true if the wallet is on device, false otherwise.

Example

import 'package:portal_flutter/portal_flutter.dart';

final portal = Portal();

final isOnDevice = await portal.isWalletOnDevice();

if (isOnDevice) {
  print('Wallet is on this device');
} else {
  print('Wallet needs to be recovered');
}

Use Case

This is useful for determining if a user needs to recover their wallet:
final exists = await portal.doesWalletExist();
final onDevice = await portal.isWalletOnDevice();

if (exists && !onDevice) {
  // Wallet exists but needs to be recovered to this device
  print('Please recover your wallet');
}

Errors

CodeDescription
NOT_INITIALIZEDPortal was not initialized