Skip to main content

Function Signature

Future<List<String>> availableRecoveryMethods([String? chainId])

Description

Returns a list of backup methods that can be used to recover the wallet.

Parameters

ParameterTypeRequiredDescription
chainIdStringNoOptional chain ID to check. If null, checks globally.

Returns

List<String> - A list of method names (e.g., ["Password", "GoogleDrive"]).

Example

import 'package:portal_flutter/portal_flutter.dart';

final portal = Portal();

final methods = await portal.availableRecoveryMethods();

print('Available recovery methods:');
for (final method in methods) {
  print('  - $method');
}

// Use the first available method
if (methods.isNotEmpty) {
  final methodName = methods.first;

  switch (methodName) {
    case 'Password':
      await portal.recoverWallet(
        method: PortalBackupMethod.password,
        password: 'user-password',
      );
      break;
    case 'GoogleDrive':
      await portal.configureGoogleStorage(clientId: 'your-client-id');
      await portal.recoverWallet(method: PortalBackupMethod.googleDrive);
      break;
    // ... other methods
  }
}

Errors

CodeDescription
NOT_INITIALIZEDPortal was not initialized